#include <pspsdk.h>

void sceSysreg_driver_26D97F66 (){
	setReset (1, 1);
}
void sceSysreg_driver_36DA035E (){
	setReset (2, 1);
}
void sceSysreg_driver_20C9E2C4 (){
	setReset (0x04, 1);
}
void sceSysreg_driver_5F190A4E (){
	setReset (0x04, 0);
}
void sceSysreg_driver_2CFF6043 (){
	setReset (0x08, 1);
}
void sceSysreg_driver_DBD8D3D2 (){
	setReset (0x08, 0);
}
void sceSysreg_driver_4FFB12A2 (){
	setReset (0x10, 1);
}
void sceSysreg_driver_CEE8BAF6 (){
	setReset (0x10, 0);
}
void sceSysreg_driver_663D5471 (){
	setReset (0x20, 1);
}
void sceSysreg_driver_35BC4DD2 (){
	setReset (0x20, 0);
}
void sceSysreg_driver_E70F8FD3 (){
	setReset (0x40, 1);
}
void sceSysreg_driver_09220B6F (){
	setReset (0x40, 0);
}
void sceSysreg_driver_77F3701E (){
	setReset (0x80, 1);
}
void sceSysreg_driver_B3F134C7 (){
	setReset (0x80, 0);
}
void sceSysreg_driver_AE663FC3 (int arg1){
	if((arg1>0)&&(arg1<2))setReset ((0x0100 << arg1), 1);
}
void sceSysreg_driver_63FBF749 (int arg1){
	if((arg1>0)&&(arg1<2))setReset ((0x0100 << arg1), 0);
}
void sceSysreg_driver_1389C30D (){
	setReset (0x0400, 1);
	return;
}
void sceSysreg_driver_DA41BE07 (){
	setReset (0x0400, 0);
}
void sceSysreg_driver_1DC62106 (){
	setReset (0x1000, 1);
}
void sceSysreg_driver_C778A8A3 (){
	setReset (0x1000, 0);
	return;
}
void sceSysreg_driver_89C72A7B (){
	setReset (0x2000, 1);
}
void sceSysreg_driver_8721EA15 (){
	setReset (0x2000, 0);
}
void setReset (int arg1, int arg2){
	int intr = sceKernelCpuSuspendIntr ();
	if(arg2)*((int *) 0xBC10004C) |= arg1
	else		*((int *) 0xBC10004C) ^= arg1 & *((int *) 0xBC10004C);
	sceKernelCpuResumeIntr (intr, arg2);
}
void sceSysreg_driver_08E0EE7E (){
	setBusClock (1, 1);
}
void sceSysreg_driver_CD36673C (){
	setBusClock (1, 0);
}
void sceSysreg_driver_3C5806AF (){
	setBusClock (2, 1);
}
void sceSysreg_driver_126F5946 (){
	setBusClock (2, 0);
}
void sceSysreg_driver_819ACEB6 (){
	setBusClock (0x04, 1);
}
void sceSysreg_driver_FE32C7C1 (){
	setBusClock (0x04, 0);
}
void sceSysreg_driver_05A0D371 (){
	setBusClock (0x08, 1);
}
void sceSysreg_driver_BE63A2B9 (){
	setBusClock (0x08, 0);
}
void sceSysregDmacplusBusClockEnable (){
	setBusClock (0x10, 1);
}
void sceSysregDmacplusBusClockDisable (){
	setBusClock (0x10, 0);
}
void sceSysreg_driver_E74CB850 (int arg1){
	if((arg1>0)&&(arg1<2))setBusClock ((0x20 << arg1), 1);
}
void sceSysreg_driver_5ECA49E4 (int arg1){
	if((arg1>0)&&(arg1<2))setBusClock ((0x20 << arg1), 0);
}
void sceSysreg_driver_3C7163B5 (){
	setBusClock (0x80, 1);
}
void sceSysreg_driver_8A56E7F1 (){
	setBusClock (0x80, 0);
}
void sceSysregAtaBusClockEnable (){
	setBusClock (0x0100, 1);
}
void sceSysregAtaBusClockDisable (){
	setBusClock (0x0100, 0);
}
void sceSysreg_driver_00CEA69D (){
	setBusClock (0x0200, 1);
}
void sceSysreg_driver_04FA5F9F (){
	setBusClock (0x0200, 0);
}
void sceSysreg_driver_CAC37836 (int arg1){
	if((arg1>0)&&(arg1<2))setBusClock ((0x0400 << arg1), 1);
}
void sceSysreg_driver_4638FA5B (int arg1){
	if((arg1>0)&&(arg1<2))setBusClock ((0x0400 << arg1), 0);
}
void sceSysreg_driver_A012D356 (){
	setBusClock (0x1000, 1);
}
void sceSysreg_driver_31BE6914 (){
	setBusClock (0x1000, 0);
}
void sceSysregEmcsmBusClockEnable (){
	setBusClock (0x2000, 1);
}
void sceSysregEmcsmBusClockDisable (){
	setBusClock (0x2000, 0);
}
void sceSysreg_driver_70DB03B3 (){
	setBusClock (0x4000, 1);
}
void sceSysreg_driver_73F75CF8 (){
	setBusClock (0x4000, 0);
}
void sceSysreg_driver_C7FC7669 (int arg1){
	if((arg1>0)&&(arg1<2))setBusClock ((0x8000 << arg1), 1);
}
void sceSysreg_driver_F9A652BC (int arg1){
	if((arg1>0)&&(arg1<2))setBusClock ((0x8000 << arg1), 0);
}
void sceSysreg_driver_97B76F89 (){
	setBusClock (0x00020000, 1);
}
void sceSysreg_driver_58B2671B (){
	setBusClock (0x00020000, 0);
}
void sceSysreg_driver_C367C076 (){
	setBusClock (0x00040000, 1);
}
void sceSysreg_driver_C03903EE (){
	setBusClock (0x00040000, 0);
}
void setBusClock (int arg1, int arg2){
	int intr = sceKernelCpuSuspendIntr ();
	if(arg2)*((int *) 0xBC100050) |= arg1;
	else *((int *) 0xBC100050) ^= *((int *) 0xBC100050) & arg1;
	sceKernelCpuResumeIntr (intr, arg2);
}
void sceSysreg_driver_AFD7C10B (){
	setClk (1, 1);
}
void sceSysreg_driver_BD89766B (){
	setClk (1, 0);
}
void sceSysreg_driver_3616B538 (){
	setClk (2, 1);
}
void sceSysreg_driver_FC42CD72 (){
	setClk (2, 0);
}
void sceSysreg_driver_7E046110 (){
	setClk (0x00010000, 1);
}
void sceSysreg_driver_4F9452D7 (){
	setClk (0x00010000, 0);
}
void sceSysreg_driver_6CD41073 (int arg1){
	if((arg1>0)&&(arg1<2))setClk ((0x0100 << arg1), 1);
}
void sceSysreg_driver_3AAE2AE9 (int arg1){
	if((arg1>0)&&(arg1<2))setClk ((0x0100 << arg1), 0);
}
void sceSysregSpiClkEnable (int arg1){
	if((arg1>0)&&(arg1<2))setClkout ((0x0100 << arg1), 1);
}
void sceSysregSpiClkDisable (int arg1){
	if((arg1>0)&&(arg1<2))setClkout ((0x0100 << arg1), 0);
}
void sceSysregUartClkEnable (int arg1){
	if((arg1>0)&&(arg1<2))setClkout ((0x40 << arg1), 1);
}
void sceSysregUartClkDisable (int arg1){
	if((arg1>0)&&(arg1<2))setClkout ((0x40 << arg1), 0);
}
void sceSysreg_driver_9C89F935 (int arg1){
	if((arg1>0)&&(arg1<2))setClkout ((0x1000 << arg1), 1);
}
void sceSysreg_driver_036D4A59 (int arg1){
	if((arg1>0)&&(arg1<2))setClkout ((0x1000 << arg1), 0);
}
void sceSysreg_driver_823FFD7A (int arg1){
	if((arg1>0)&&(arg1<2))setClkout ((0x00010000 << arg1), 1);
}
void sceSysreg_driver_E2412D26 (int arg1){
	if((arg1>0)&&(arg1<2))setClkout ((0x00010000 << arg1), 0);
}
void sceSysreg_driver_F092AED8 (){
	setClkout (0x00040000, 1);
}
void sceSysreg_driver_280F9241 (){
	setClkout (0x00040000, 0);
}
void sceSysreg_driver_8684E7A1 (){
	setClkout (0x00080000, 1);
}
void sceSysreg_driver_03BD35E5 (){
	setClkout (0x00080000, 0);
}
void sceSysreg_driver_C0BC0E36 (){
	setClkout (0x00100000, 1);
}
void sceSysreg_driver_4ACB2BB3 (){
	setClkout (0x00100000, 0);
}
void sceSysreg_driver_04839CA2 (){
	setClkout (0x00200000, 1);
}
void sceSysreg_driver_917F9660 (){
	setClkout (0x00200000, 0);
}
void sceSysregSircsClkEnable (){
	setClkout (0x00400000, 1);
}
void sceSysregSircsClkDisable (){
	setClkout (0x00400000, 0);
}
void sceSysreg_driver_2E9CF295 (){
	setClkout (0x00800000, 1);
}
void sceSysreg_driver_E987E988 (){
	setClkout (0x00800000, 0);
}
void sceSysreg_driver_7A154A45 (){
	setClkout (0x01000000, 1);
}
void sceSysreg_driver_CA84A2D9 (){
	setClkout (0x01000000, 0);
}
void setClk (int arg1, int arg2){
	int intr = sceKernelCpuSuspendIntr ();
	if(arg2)*((int *) 0xBC100054) |= arg1;
	else		*((int *) 0xBC100054) ^= arg1 & *((int *) 0xBC100054);
	sceKernelCpuResumeIntr (intr, arg2);
}
void setClkout (int arg1, int arg2){
	int intr = sceKernelCpuSuspendIntr ();
	if(arg2)*((int *) 0xBC100058) |= arg1;
	else		*((int *) 0xBC100058) ^= arg1 & *((int *) 0xBC100054);
	sceKernelCpuResumeIntr (intr, arg2);
}
void sceSysreg_driver_D5F04B96 (int arg1){
	setClkEx (arg1, 1);
}
void sceSysreg_driver_C60904D4 (int arg1){
	setClkEx (arg1, 0);
}
void setClkEx (int arg1, int arg2){
	int intr = sceKernelCpuSuspendIntr ();
	if(!arg2) *((int *) 0xBC100054) = (*((int *) 0xBC100054)&~0xF0)|((((*((int *) 0xBC100054)>>4)&0xF)|arg1));
	else      *((int *) 0xBC100054) = (*((int *) 0xBC100054)&~0xF0)|((((*((int *) 0xBC100054)>>4)&0xF)|arg1)&0x0F);
	sceKernelCpuResumeIntr (intr, arg2);
}
void sceSysregEmcsmIoEnable (){
	setIo (2, 1);
}
void sceSysregEmcsmIoDisable (){
	setIo (2, 0);
}
void sceSysreg_driver_03E84901 (){
	setIo (0x04, 1);
}
void sceSysreg_driver_B5CD678F (){
	setIo (0x04, 0);
}
void sceSysreg_driver_463B488C (){
	setIo (0x08, 1);
}
void sceSysreg_driver_421E5DCF (){
	setIo (0x08, 0);
}
void sceSysreg_driver_86D9213D (int arg1){
	if((arg1>0)&&(arg1<2))setIo ((0x10 << arg1), 1);
}
void sceSysreg_driver_9FBCA4D0 (int arg1){
	if((arg1>0)&&(arg1<2))setIo ((0x10 << arg1), 0);
}
void sceSysreg_driver_BEF287D5 (){
	setIo (0x40, 1);
}
void sceSysreg_driver_FF6D37E7 (){
	setIo (0x40, 0);
}
void sceSysreg_driver_410C74F7 (int arg1){
	if (arg1 < 0)return;
	if (((arg1 < 2)) == 0)return;
	setIo ((0x80 << arg1), 1);
}
void sceSysreg_driver_3841D7C8 (int arg1){
	if (arg1 < 0)return;
	if (((arg1 < 2)) == 0)return;
	setIo ((0x80 << arg1), 0);
}
void sceSysreg_driver_23944179 (){
	setIo (0x0200, 1);
}
void sceSysreg_driver_6D204F2A (){
	setIo (0x0200, 0);
}
void sceSysregSircsIoEnable (){
	setIo (0x0400, 1);
}
void sceSysregSircsIoDisable (){
	setIo (0x0400, 0);
}
void sceSysreg_driver_E46A0890 (){
	setIo (0x0800, 1);
}
void sceSysreg_driver_77B582E9 (){
	setIo (0x0800, 0);
}
void sceSysreg_driver_9B2871A8 (){
}
void sceSysreg_driver_3160E8A2 (){
}
void sceSysreg_driver_6B5C5FD0 (){
	setIo (0x2000, 1);
}
void sceSysreg_driver_80995BB5 (){
	setIo (0x2000, 0);
}
void sceSysreg_driver_FB40B1AA (){
	setIo (0x4000, 1);
}
void sceSysreg_driver_3F0DF46D (){
	setIo (0x4000, 0);
}
void sceSysregUartIoEnable (int arg1){
	if (arg1 < 0)return
	if (((arg1 < 6)) == 0)return;
	setIo ((0x00010000 << arg1), 1);
}
void sceSysregUartIoDisable (int arg1){
	if (arg1 < 0)return
	if (((arg1 < 6)) == 0)return;
	setIo ((0x00010000 << arg1), 0);
}
void sceSysregSpiIoEnable (int arg1){
	if (arg1 < 0)return
	if (((arg1 < 6)) == 0)return;
	setIo ((0x01000000 << arg1), 1);
}
void sceSysregSpiIoDisable (int arg1){
	if (arg1 < 0)return
	if (((arg1 < 6)) == 0)return;
	setIo ((0x01000000 << arg1), 0);
}
void setIo (int arg1, int arg2){
	intr = sceKernelCpuSuspendIntr ();
	prev = *((int *) 0xBC100078);
	*((int *) 0xBC100078) = (!(arg2) ? (prev ^ prev & arg1) : (prev | arg1));
	sceKernelCpuResumeIntr (intr, arg2);
}
void sceSysreg_driver_217316F7 (int arg1){
	if (arg1<0)return;
	if (arg1>=0x20)return;
	sub_00B04 ((1 << arg1), 1);
}
void sceSysreg_driver_C0D33340 (int arg1){
	if (arg1<0)return;
	if (arg1>=0x20)return;
	sub_00B04 ((1 << arg1), 0);
}
void sub_00B04 (int arg1, int arg2){
	var3 = sceKernelCpuSuspendIntr ();
	prev = *((int *) 0xBC10007C);
	*((int *) 0xBC10007C) = (!(arg2) ? (prev ^ (prev & arg1)) : (prev | arg1));
	sceKernelCpuResumeIntr (var3, arg2);
}
void sceSysreg_driver_64C2D131 (int arg1){
	sub_00BA4 (arg1, 0, 1);
}
void sceSysreg_driver_ACA3F3A3 (int arg1){
	sub_00BA4 (arg1, 1, 1);
}
void sceSysreg_driver_19DF2827 (int arg1){
	sub_00BA4 (arg1, 0, 2);
}
void sceSysreg_driver_02A1F862 (int arg1){
	sub_00BA4 (arg1, 1, 2);
}
void sceSysreg_driver_2FCFA7CD (){
	sub_00BCC (0x0100, 1);
}
void sceSysreg_driver_E440DC4A (){
	sub_00BCC (0x0100, 0);
}
void sub_00BA4 (int arg1, int arg2, int arg3){
	if (arg1 < 0)return;
	if (arg1 >= 2)return;
	sub_00BCC ((arg3 << (arg1 << 2)), arg2);
}
void sub_00BCC (int arg1, int arg2){
	intr = sceKernelCpuSuspendIntr ();
	if(arg2)*((int *) 0xBC100074)|=arg1;
	else    *((int *) 0xBC100074)^=arg1&*((int *) 0xBC100074);
	sceKernelCpuResumeIntr (intr, arg2);
	return = 0 < *((int *) 0xBC100074) & arg1;
}
void sceSysreg_driver_12EF2C08 (){
	return *((int *) 0xBC100080);
}
void sceSysreg_driver_0C3CFD86 (){
	var1 = *((int *) 0xBC100080);
}
void sceSysreg_driver_7911A536 (int arg1){
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xBC100080) = (((arg1 & ((*((int *) 0xBC100080) >> 1) & 0xF)) & 0xF) << 1);
	sceKernelCpuResumeIntrWithSync (intr);
}
void sceSysreg_driver_F464A3D9 (){
	return *((int *) 0xBC1000B0);
}
void sceSysreg_driver_8D4FE210 (int arg1){
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xBC1000B0) = ((arg1 & (*((int *) 0xBC1000B0) & 7)) & 7);
	sceKernelCpuResumeIntrWithSync (intr);
}
void sceSysreg_driver_49B453CB (int arg1){
	if (arg1 < 0)return;
	if (arg1 >= 2)return;
	return *((int *) 0xBC100080);
}
void sceSysreg_driver_36BBA207 (int arg1){
	if (arg1 < 0)return;
	if (arg1 >= 2)return;
	return *((int *) 0xBC100080);
}
void sceSysreg_driver_BA43633B (int arg1, int arg2){
	if (arg1 < 0)return;
	if (arg1 >= 2)return;
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xBC100080) = (((arg2 & (((*((int *) 0xBC100080) >> (arg1 << 3)) >> 9) & 7)) << 9) << (arg1 << 3));
	sceKernelCpuResumeIntrWithSync (intr);
}
void sceSysreg_driver_EEE7B082 (){
	__asm__ ("sync;");
	*((int *) 0xBC100044) = 1;
	__asm__ ("sync;");
}
int sceSysreg_driver_461B8077 (){
	__asm__ ("mfc0			 $v1, COP0_22;" : "=r"(var1));
	__asm__ ("sync;");
	*((int *) 0xBC100048) = var1 + 1;
	return (!(((*((int *) 0xBC100048) & 3) ^ *((int *) 0xBC100048))) ? 0 : -1);
}
void sceSysreg_driver_0E6301D0 (){
	__asm__ ("sync;");
	*((int *) 0xBC100048) = 0;
	__asm__ ("sync;");
}
int sceSysreg_driver_F03852E0 (int arg1){
	intr = sceKernelCpuSuspendIntr ();
	while (sceSysreg_driver_461B8077 ());
	sceSysreg_driver_0E6301D0 ();
	sceKernelCpuResumeIntr (intr);
	return *arg1;
}
int sceSysreg_driver_9CE69EC1 (int arg1, int arg2, int arg3){
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	((int *) sp)[1] = arg1;
	((int *) sp)[2] = arg2;
	((int *) sp)[3] = arg3;
	var3 = sceKernelCpuSuspendIntr ();
	while (1) {
		var6 = sceSysreg_driver_461B8077 ();
		if (var6 < 0)
			continue;
		break;
	}
	var7 = ((int *) sp)[1];
	var8 = ((int *) sp)[2];
	var9 = ((int *) sp)[3];
	var10 = ((int *) var7)[0];
	((int *) var7)[0] = ((var10 & var8) | var9);
	((int *) sp)[3] = var10;
	sceSysreg_driver_0E6301D0 ();
	sceKernelCpuResumeIntr ();
	ra = ((int *) sp)[0];
	var15 = ((int *) sp)[3];
	sp = sp + 0x10;
	return var15;
}
void sceDdrInit (){
	return;
}
void sceDdrEnd (){
	return;
}
void sceDdrSuspend (){
	return;
}
void sceDdrResume (){
	return;
}
void sceDdrFlush (int arg1){
	__asm__ ("sync;");
	*((int *) 0xBD000004) = arg1 & 0xF;
	while (*((int *) 0xBD000004) & (arg1 & 0xF));
}
void sceDdr_driver_647FEC11 (int arg1){
	*((int *) 0xBD00002C) = ((((arg1 < 1))) ? 0 : (0x80000000 | arg1));
	__asm__ ("sync;");
	return;
}
void sceDdr_driver_DC921C35 (){
	return *((int *) 0xBD00002C);
}
int sceDdr_driver_C6B7CCDE (){
	var1 = 1;
	var2 = 0x40;
	while (var2--) {
		*((int *) 0xBD000040) = 0x2B;
		if ((*((int *) 0xBD000040) & 0x0100))break;
		var1++;
	}
	var5 = var1 + 1;
	while (var5--) {
		*((int *) 0xBD000040) = 0x2A;
		0 = *((int *) 0xBD000040);
	}
	*((int *) 0xBD000040) = 0x20;
	__asm__ ("sync;");
	return var1;
}
void sceDdr_driver_CFC352DF (int arg1, int arg2, int arg3){
	while (((*((int *) 0xBD000020) >> 16) & 1));
	*((int *) 0xBD000024) = ((((arg1 & 1) << 0x0A) | (arg2 << 0x10)) | (arg3 & 0x7BFF));
	__asm__ ("sync;");
	*((int *) 0xBD000020) = (arg1 | 0x8000);
	__asm__ ("sync;");
	while ((*((int *) 0xBD000020) >> 16) & 1);
}
void sceDdr_driver_75B600EF (int arg1, int arg2, int arg3, int arg4){
	sceDdr_driver_19423D2C (arg3);
	sceDdr_driver_D341BACD ();
	var6 = t8;
	if (var6<0)var6 = 1;
	sceDdr_driver_740F2933 (t7, var6);
}
void sceDdr_driver_19423D2C (int arg1){
	var1 = 0xB970 + (arg1 << 0x03);
	var2 = ((int *) var1)[0];
	var3 = ((int *) var1)[1];
	var4 = *((int *) 0xBD000030);
	*((int *) 0xBD000030) = (((var4 | 0x31) ^ 0x31) | var2);
	*((int *) 0xBD000038) = var3;
	__asm__ ("sync;");
	return;
}
void sceDdr_driver_ABFCB233 (){
	return *((int *) 0xBD000030);
}
void sceDdr_driver_740F2933 (int arg1, int arg2){
	sceDdr_driver_CFC352DF (0x25, 0, 0);
	sceDdr_driver_CFC352DF (0x22, 0, 0);
	sceDdr_driver_CFC352DF (0x22, 0, 0);
	sceDdr_driver_CFC352DF (0x20, 0, ((a3/* Invalid block 7 2 */ << 0x04) | 1));
	sceDdr_driver_CFC352DF (0x20, 2, (t6/* Invalid block 9 2 */ << 0x05));
	return;
}

/**
 * Subroutine at address 0x111C
 */
void sceDdr_driver_B4D05E62 (int arg1, int arg2)
{
	sceDdr_driver_CFC352DF (0x20, 2, (arg2 << 0x05));
	return;
}

/**
 * Subroutine at address 0x1130
 */
void sub_01130 (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
{
	var1 = ra;
	sceDdr_driver_D341BACD ();
	if (!(t5/* Invalid block 3 2 */ < 0))
	{
		sceDdr_driver_A0FA6221 (t5/* Invalid block 3 2 */);
	}
	*((int *) 0xBC100068) = (t4/* Invalid block 7 7 */ | 0x80);
	__asm__ ("sync;");
	if (!(t6/* Invalid block 7 7 */ < 0))
	{
		sceDdr_driver_7271F86A (t6/* Invalid block 7 7 */, t7/* Invalid block 7 7 */);
		var8 = 2;
		var9 = 0x015E;
		while (1) {
			var10 = *((int *) 0xBD000040);
			var9 = var9 + 0xFFFFFFFF;
			if (var9 < 0)
				break;
			if ((var10 & 0x0100) == 0)
				continue;
			while (1) {
				var11 = *((int *) 0xBD000040);
				var9 = var9 + 0xFFFFFFFF;
				if (var9 < 0)
					break;
				if ((var11 & 0x0100) != 0)
					continue;
				var8 = var8 + 0xFFFFFFFF;
				if (var8 > 0)
					continue;
				break;
			}
		}
		if (!(t8/* Invalid block 9 2 */ == 0))
		{
			while (1) {
				__asm__ ("cache			0x19, 0($t8);"
					: 
					: "=r"(t8/* Invalid block 9 2 */));
				var12 = ((int *) t8/* Invalid block 9 2 */)[0];
				var13 = ((int *) t8/* Invalid block 9 2 */)[1];
				var14 = ((int *) t8/* Invalid block 9 2 */)[2];
				var15 = ((int *) t8/* Invalid block 9 2 */)[3];
				if (((!(var13 & (var14 | var15))) | (var12 | ((ROTV (1, var14)) ^ var15))) != 0)
					continue;
				break;
			}
		}
	}
	return;
}

/**
 * Subroutine at address 0x1210
 */
void sceDdr_driver_D341BACD ()
{
	var1 = ra;
	sceDdr_driver_D341BACD ();
	var4 = ra + 0xD4;
	var5 = var4 + (a0/* Invalid block 3 2 */ << 0x03);
	var6 = ((int *) var5)[0];
	var7 = ((int *) var5)[1];
	var8 = *((int *) 0xBD000030);
	*((int *) 0xBD000030) = ((var8 & 0x31) | (var6 | ((a1/* Invalid block 3 2 */ + 0xFFFFFFFD) << 0x0C)));
	*((int *) 0xBD000044) = (var7 & 0xFFFF);
	*((int *) 0xBD000034) = (var7 >> 0x10);
	__asm__ ("sync;");
	return;
}

/**
 * Subroutine at address 0x1268
 */
void sceDdr_driver_A0FA6221 (int arg1)
{
	var1 = 0x40;
	while (1) {
		*((int *) 0xBD000040) = 0x2B;
		0 = *((int *) 0xBD000040);
		var1 = var1 + 0xFFFFFFFF;
		if (var1 != 0)
			continue;
		break;
	}
	var2 = arg1 + 1;
	while (1) {
		*((int *) 0xBD000040) = 0x2A;
		0 = *((int *) 0xBD000040);
		var2 = var2 + 0xFFFFFFFF;
		if (var2 != 0)
			continue;
		break;
	}
	return;
}

/**
 * Subroutine at address 0x12AC
 */
void sceDdr_driver_7271F86A (int arg1, int arg2)
{
	*((int *) 0xBD000040) = (arg2 | 0x10);
	0 = *((int *) 0xBD000040);
	*((int *) 0xBD000040) = (arg1 | 0x10);
	0 = *((int *) 0xBD000040);
	*((int *) 0xBD000040) = 0x20;
	__asm__ ("sync;");
	return;
}

/**
 * Subroutine at address 0x1370
 */
void module_start (int arg1, int arg2){
	sceKernelUnregisterSysEventHandler (0xBD40);
	sceSysreg_driver_9E170EF1 ();
	sceSysreg_driver_2456AE40 ();
	sceKernelRegisterSysEventHandler (0xBD40);
	sceGpioInit ();
	scePwm_driver_19D581D3 ();
	sub_04494 ();
	sub_04D04 ();
	sceLcdc_driver_9182FB30 ();
	sceNandInit();
	sceDdrInit ();
	memcpy (0xBFC00C00, 0x1130, (0x1370 - 0x1130));
	DmacManForKernel_32757C57 (0x0F04);
}

/**
 * Subroutine at address 0x13F8
 */
void module_reboot_before (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	((int *) sp)[1] = ra;
	var1 = arg1;
	sub_0A6B0 ();
	sub_08DAC ();
	sub_07DB4 ();
	sub_04D88 ();
	sub_04564 ();
	sub_0332C ();
	sub_02934 ();
	sub_014A0 ();
	ra = ((int *) sp)[1];
	var18 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x14A0
 */
void sub_014A0 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceSysreg_driver_B0FDD88C ();
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x14C0
 */
void sceSysregInit ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceKernelUnregisterSysEventHandler (0xBD40);
	sceSysreg_driver_9E170EF1 ();
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x14EC
 */
void sceSysregEnd ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceSysreg_driver_B0FDD88C ();
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x150C
 */
void sub_0150C ()
{
	return;
}

/**
 * Subroutine at address 0x1514
 */
int sceSysreg_driver_12DDDF43 (int arg1, int arg2){//sceSysregDoTimerEvent
	if (arg1>1)return 0x80000102
	if (arg2>3)return 0x80000107;
	int intr = sceKernelCpuSuspendIntr ();
	if (arg2 == 0){
		*((int *) 0xBC10003C) &= !1<<arg1;
	}else if (arg2 == 1){
		*((int *) 0xBC10003C) |=	1<<arg1;
	}else if (arg2 == 2){
		*((int *) 0xBC10003C) |=	1<<arg1;
		*((int *) 0xBC10003C) &= !1<<arg1;
	}else if (arg2 == 3){
		*((int *) 0xBC10003C) &= !1<<arg1;
		*((int *) 0xBC10003C) |=	1<<arg1;
	}
	sceKernelCpuResumeIntrWithSync (intr);
	return 0;
}

/**
 * Subroutine at address 0x15FC
 */
void sceSysreg_driver_7F734EE7 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	((int *) sp)[2] = ra;
	((int *) sp)[1] = s1;
	var3 = sceSysregGetTachyonVersion ();
	if (((0x004FFFFF < var3)) != 0)
	{
		var8 = sceKernelCpuSuspendIntr ();
		__asm__ ("sync;");
		var9 = *((int *) 0xBC100040);
		if (arg1 == 0)
		{
			*((int *) 0xBC100040) = ((var9 & 0xFFFFFEFF) | (0 & 1));
		}
		else
		{
			*((int *) 0xBC100040) = (var9 | 0x0100);
		}
		sceKernelCpuResumeIntrWithSync (var8);
	}
	ra = ((int *) sp)[2];
	var4 = ((int *) sp)[1];
	var5 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1684
 */
int sceSysregGetTachyonVersion ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = *((int *) 0xBD80);
	((int *) sp)[1] = s1;
	var2 = var1;
	((int *) sp)[2] = ra;
	if (var1 == 0xFFFFFFFF)
	{
		var7 = sceKernelCpuSuspendIntr ();
		var8 = *((int *) 0xBC100040);
		var9 = (var8 & 0xFF000000) | (0 & 0x00FFFFFF);
		var10 = var9 >> 0x08;
		var11 = (var9) ? var10 : 0x00100000;
		*((int *) 0xBD80) = var11;
		sceKernelCpuResumeIntr (var7, var10, var9);
		var2 = var11;
	}
	ra = ((int *) sp)[2];
	var3 = ((int *) sp)[1];
	var4 = ((int *) sp)[0];
	sp = sp + 0x10;
	return var2;
}

/**
 * Subroutine at address 0x16F4
 */
void sceSysreg_driver_F287DB37 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = ra;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var3 = sceKernelCpuSuspendIntr ();
	var4 = *((int *) 0xBC10003C);
	*((int *) 0xBC10003C) = (!(arg1) ? ((var4 & 0xFFFFFFFE) | (0 & 1)) : (var4 | 1));
	sceKernelCpuResumeIntrWithSync (var3);
	ra = ((int *) sp)[2];
	var7 = ((int *) sp)[1];
	var8 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x174C
 */
void sceSysreg_driver_0BF6F901 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var3 = sceKernelCpuSuspendIntr ();
	var4 = *((int *) 0xBC10003C);
	*((int *) 0xBC10003C) = (var4 ^ 1);
	__asm__ ("sync;");
	*((int *) 0xBC10003C) = var4;
	sceKernelCpuResumeIntrWithSync (var3);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1790
 */
void sceSysreg_driver_17B132D5 (int arg1, int arg2)
{
	__asm__ ("sync;");
	var1 = *((int *) 0xBC000044);
	if (arg2 == 0)
	{
		var2 = var1 & (!arg1);
	}
	else
	{
		var2 = var1 | arg1;
	}
	*((int *) 0xBC000044) = var2;
	__asm__ ("sync;");
	return;
}

/**
 * Subroutine at address 0x17C0
 */
void sceSysregGetFuseId ()
{
	var1 = *((int *) 0xBC100090);
	var2 = *((int *) 0xBC100094);
	return;
}

/**
 * Subroutine at address 0x17E4
 */
void sceSysregGetFuseConfig ()
{
	var1 = *((int *) 0xBC100098);
	return;
}

/**
 * Subroutine at address 0x17F4
 */
void sceSysreg_driver_FF39996C ()
{
	__asm__ ("lwc1			 $fpr00, -18012($v1);");
	return;
}

/**
 * Subroutine at address 0x1800
 */
void sceSysreg_driver_2456AE40 ()
{
	var1 = *((int *) 0xBC100068);
	var2 = *((int *) 0xBC1000FC);
	__asm__ ("lwc1			 $fpr00, -18008($t0);");
	var3 = (var2 >> 8) & 0xFF;
	__asm__ ("mtc1			 $v1, $fpr5;"
		: 
		: "=r"(var3));
	__asm__ ("cvt.s.w		$fpr04, $fpr05;");
	__asm__ ("mul.s			$fpr02, $fpr04, $fpr00;"
					 "lwc1			 $fpr03, 0($a0);");
	var4 = 0x00010000;
	__asm__ ("mul.s			$fpr00, $fpr02, $fpr03;");
	__asm__ ("swc1			 $fpr00, -16560($v1);"
		: 
		: "=r"(0x00010000));
	return;
}

/**
 * Subroutine at address 0x1858
 */
void sceSysreg_driver_9AFD029D ()
{
	__asm__ ("lwc1			 $fpr00, -16560($v1);");
	return;
}

/**
 * Subroutine at address 0x1864
 */
void sceSysreg_driver_DA1CD053 ()
{
	var1 = *((int *) 0xBC100068);
	return;
}

/**
 * Subroutine at address 0x1878
 */
void sceSysreg_driver_BC3D9C91 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	var1 = arg1;
	((int *) sp)[0] = s0;
	((int *) sp)[2] = ra;
	if (var1 < 0)
	{

	label9:
	}
	else
	{
		if (!((((arg1 & 0x07) < 6)) != 0))
			goto label9;
		var6 = sceKernelCpuSuspendIntr ();
		var7 = *((int *) 0xBC100068);
		__asm__ ("lwc1			 $fpr01, -18004($a1);");
		*((int *) 0xBC100068) = ((((var7 & 0xFFFFFFF0) | (0 & 0x0F)) | var1) | 0x80);
		var8 = *((int *) 0xBC100068);
		var9 = *((int *) 0xBC1000FC);
		var10 = (var9 >> 8) & 0xFF;
		__asm__ ("mtc1			 $t2, $fpr5;"
			: 
			: "=r"(var10));
		__asm__ ("cvt.s.w		$fpr02, $fpr05;"
						 "lwc1			 $fpr04, 0($a2);");
		var11 = 0x00010000;
		__asm__ ("mul.s			$fpr03, $fpr02, $fpr01;"
						 "mul.s			$fpr00, $fpr03, $fpr04;");
		__asm__ ("swc1			 $fpr00, -16560($v1);"
			: 
			: "=r"(0x00010000));
		sceKernelCpuResumeIntr (var6, 0x00010000, (((var8 & 0x0F) << 2) + 0xB9BC));
	}
	ra = ((int *) sp)[2];
	var2 = ((int *) sp)[1];
	var3 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1944
 */
void sceSysreg_driver_B93CCA2B (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	var1 = 0x80000102;
	((int *) sp)[3] = ra;
	if (!(((arg1 < 2)) == 0))
	{
		var1 = 0x800001FE;
		if (!(((arg2 < 0x03)) == 0))
		{
			var4 = sceKernelCpuSuspendIntr ();
			var5 = arg1 << 1;
			var6 = *((int *) 0xBC10005C);
			var7 = (var6 & (!(0x03 << var5))) | (arg2 << var5);
			var1 = (var6 >> var5) & 0x03;
			*((int *) 0xBC10005C) = var7;
			sceKernelCpuResumeIntr (var4, var6, var7);
		}
	}
	ra = ((int *) sp)[3];
	var10 = ((int *) sp)[2];
	var11 = ((int *) sp)[1];
	var12 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x19E0
 */
void sceSysreg_driver_262667F9 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	var1 = 0x80000102;
	((int *) sp)[3] = ra;
	if (!(((arg1 < 2)) == 0))
	{
		var1 = 0x800001FE;
		if (!(((arg2 < 0x08)) == 0))
		{
			var4 = sceKernelCpuSuspendIntr ();
			var5 = arg1 << 2;
			var6 = *((int *) 0xBC000050);
			var7 = (var6 & (!(0x07 << var5))) | (arg2 << var5);
			var1 = (var6 >> var5) & 0x07;
			*((int *) 0xBC000050) = var7;
			sceKernelCpuResumeIntr (var4, var6, var7);
		}
	}
	ra = ((int *) sp)[3];
	var10 = ((int *) sp)[2];
	var11 = ((int *) sp)[1];
	var12 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1A7C
 */
void sceSysreg_driver_E46031A1 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	var1 = 0x80000102;
	((int *) sp)[3] = ra;
	if (!(((arg1 < 0x04)) == 0))
	{
		var1 = 0x800001FE;
		if (!(((arg2 < 0x08)) == 0))
		{
			var4 = sceKernelCpuSuspendIntr ();
			var5 = arg1 << 2;
			var6 = *((int *) 0xBC100060);
			var7 = (var6 & (!(0x07 << var5))) | (arg2 << var5);
			var1 = (var6 >> var5) & 0x07;
			*((int *) 0xBC100060) = var7;
			sceKernelCpuResumeIntr (var4, var6, var7);
		}
	}
	ra = ((int *) sp)[3];
	var10 = ((int *) sp)[2];
	var11 = ((int *) sp)[1];
	var12 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1B18
 */
void sceSysreg_driver_923509A1 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	var1 = 0x80000102;
	((int *) sp)[3] = ra;
	if (!(((arg1 < 2)) == 0))
	{
		var1 = 0x800001FE;
		if (!(((arg2 < 2)) == 0))
		{
			var4 = sceKernelCpuSuspendIntr ();
			var5 = arg1 + 0x10;
			var6 = *((int *) 0xBC100060);
			var7 = (var6 & (!(1 << var5))) | (arg2 << var5);
			var1 = (var6 >> var5) & 1;
			*((int *) 0xBC100060) = var7;
			sceKernelCpuResumeIntr (var4, var6, var7);
		}
	}
	ra = ((int *) sp)[3];
	var10 = ((int *) sp)[2];
	var11 = ((int *) sp)[1];
	var12 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1BB4
 */
void sceSysregSpiClkSelect (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	var1 = 0x80000102;
	((int *) sp)[3] = ra;
	if (!(((arg1 < 6)) == 0))
	{
		var1 = 0x800001FE;
		if (!(((arg2 < 0x08)) == 0))
		{
			var4 = sceKernelCpuSuspendIntr ();
			var5 = arg1 << 2;
			var6 = *((int *) 0xBC100064);
			var7 = (var6 & (!(0x07 << var5))) | (arg2 << var5);
			var1 = (var6 >> var5) & 0x07;
			*((int *) 0xBC100064) = var7;
			sceKernelCpuResumeIntr (var4, var6, var7);
		}
	}
	ra = ((int *) sp)[3];
	var10 = ((int *) sp)[2];
	var11 = ((int *) sp)[1];
	var12 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1C50
 */
void sceSysreg_driver_8FA2F8C0 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	var1 = 0x80000102;
	((int *) sp)[3] = ra;
	if (!(((arg1 < 2)) == 0))
	{
		var1 = 0x80000102;
		if (!(((arg2 < 0x03)) == 0))
		{
			var4 = sceKernelCpuSuspendIntr ();
			var5 = *((int *) 0xBC100060);
			var1 = (var5 >> 20) & 0x07;
			var6 = ((var5 & 0xFF8FFFFF) | (0 & 0x07)) | (arg1 << 0x16);
			var7 = var6 | (arg2 << 0x14);
			*((int *) 0xBC100060) = var7;
			sceKernelCpuResumeIntr (var4, var7, var6);
		}
	}
	ra = ((int *) sp)[3];
	var10 = ((int *) sp)[2];
	var11 = ((int *) sp)[1];
	var12 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1CE0
 */
void sceSysreg_driver_7E94B309 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = 0x800001FE;
	((int *) sp)[2] = ra;
	if (!(((arg1 < 0x03)) == 0))
	{
		var4 = sceKernelCpuSuspendIntr ();
		var5 = *((int *) 0xBC10005C);
		var1 = (var5 >> 4) & 0x03;
		var6 = ((var5 & 0xFFFFFFCF) | (0 & 0x03)) | (arg1 << 0x04);
		*((int *) 0xBC10005C) = var6;
		sceKernelCpuResumeIntr (var4);
	}
	ra = ((int *) sp)[2];
	var9 = ((int *) sp)[1];
	var10 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1D4C
 */
void sceSysreg_driver_AE32DCF5 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = 0x800001FE;
	((int *) sp)[2] = ra;
	if (!(((arg1 < 0x03)) == 0))
	{
		var4 = sceKernelCpuSuspendIntr ();
		var5 = *((int *) 0xBC10005C);
		var1 = (var5 >> 8) & 0x03;
		var6 = ((var5 & 0xFFFFFCFF) | (0 & 0x03)) | (arg1 << 0x08);
		*((int *) 0xBC10005C) = var6;
		sceKernelCpuResumeIntr (var4);
	}
	ra = ((int *) sp)[2];
	var9 = ((int *) sp)[1];
	var10 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1DB8
 */
void sceSysreg_driver_48869494 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = 0x800001FE;
	((int *) sp)[2] = ra;
	if (!(((arg1 < 2)) == 0))
	{
		var4 = sceKernelCpuSuspendIntr ();
		var5 = *((int *) 0xBC100060);
		var1 = (var5 >> 18) & 1;
		var6 = ((var5 & 0xFFFBFFFF) | (0 & 1)) | (arg1 << 0x12);
		*((int *) 0xBC100060) = var6;
		sceKernelCpuResumeIntr (var4);
	}
	ra = ((int *) sp)[2];
	var9 = ((int *) sp)[1];
	var10 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1E24
 */
void sceSysreg_driver_94A99040 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	((int *) sp)[1] = ra;
	if (!(((((arg2 < 0x20)) ^ 1) | (((var1 < 2)) ^ 1)) != 0))
	{
		var4 = sceSysreg_driver_9CE69EC1 (((var1 << 2) + 0xBFC00400), 0, (1 << arg2));
		__asm__ ("mfc0			 $t3, COP0_22;"
			: "=r"(var5));
		if (!(var1 == var5))
		{
			sceSysreg_driver_EEE7B082 ();
		}
	}
	ra = ((int *) sp)[1];
	var8 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1EA0
 */
void sceSysreg_driver_9E170EF1 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceKernelRegisterIntrHandler (0x1F, 2, 0x204C, 0, 0xBA28);
	sceKernelEnableIntr (0x1F);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1EE0
 */
void sceSysreg_driver_B0FDD88C ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceKernelReleaseIntrHandler (0x1F);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1F00
 */
void sceSysreg_driver_D56A288F (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	var2 = 0x80000102;
	((int *) sp)[1] = ra;
	if (!(((arg1 < 0x20)) == 0))
	{
		var5 = sceKernelCpuSuspendIntr ();
		var6 = *((int *) 0xBF54);
		var7 = 1 << var1;
		var8 = var6 | var7;
		*((int *) 0xBF54) = var8;
		sceKernelCpuResumeIntr (var5, var7, var8);
		var2 = ((var6 >> var1) & 1);
	}
	ra = ((int *) sp)[1];
	var11 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1F68
 */
void sceSysreg_driver_06305339 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	var2 = 0x80000102;
	((int *) sp)[1] = ra;
	if (!(((arg1 < 0x20)) == 0))
	{
		var5 = sceKernelCpuSuspendIntr ();
		var6 = *((int *) 0xBF54);
		var7 = !(1 << var1);
		var8 = var6 & var7;
		*((int *) 0xBF54) = var8;
		sceKernelCpuResumeIntr (var5, var7, var8);
		var2 = ((var6 >> var1) & 1);
	}
	ra = ((int *) sp)[1];
	var11 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x1FD4
 */
void sceSysreg_driver_B5DDBE9F (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg2;
	((int *) sp)[1] = ra;
	var2 = 0x80000102;
	if (!(((((var1 < 0x20)) ^ 1) | (((arg1 < 2)) ^ 1)) != 0))
	{
		var5 = sceSysreg_driver_9CE69EC1 (((arg1 << 2) + 0xBFC00400), (!(1 << arg2)), 0);
		var2 = (var5 >> var1) & 1;
	}
	ra = ((int *) sp)[1];
	var6 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x204C
 */
void sub_0204C (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[4] = s4;
	((int *) sp)[3] = s3;
	((int *) sp)[5] = ra;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	__asm__ ("mfc0			 $v0, COP0_22;"
		: "=r"(var1));
	var2 = (var1 << 2) + 0xBFC00400;
	var5 = sceSysreg_driver_F03852E0 (var2);
	var6 = *((int *) 0xBF54);
	var7 = var5 & var6;
	if (var7 != 0)
	{
		var13 = *((int *) 0xBF58);
		var14 = ((var13 - (CLZ ((ROTV (var13, var7))))) + 0x1F) & 0x1F;
		var17 = sceSysreg_driver_9CE69EC1 (var2, (!(1 << var14)), 0);
		var18 = *((int *) 0xBF58);
		*((int *) 0xBF58) = ((var18 + 1) & 0x1F);
		InterruptManagerForKernel_8BE96A2E (arg1, var14, var14, arg3);
		ra = ((int *) sp)[5];
	}
	else
	{
		ra = ((int *) sp)[5];
	}
	var8 = ((int *) sp)[4];
	var9 = ((int *) sp)[3];
	var10 = ((int *) sp)[2];
	var11 = ((int *) sp)[1];
	var12 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x2120
 */
void sub_02120 (int arg1, int arg2)
{
	var1 = *((int *) 0xBF54);
	*((int *) 0xBF54) = (var1 | (1 << arg2));
	return;
}

/**
 * Subroutine at address 0x2140
 */
void sub_02140 (int arg1, int arg2)
{
	var1 = *((int *) 0xBF54);
	*((int *) 0xBF54) = (var1 & (!(1 << arg2)));
	return;
}

/**
 * Subroutine at address 0x2164
 */
void sub_02164 (int arg1, int arg2, int arg3)
{
	if (!(arg3 == 0))
	{
		var1 = *((int *) 0xBF54);
		((int *) arg3)[0] = ((var1 >> arg2) & 1);
	}
	var2 = *((int *) 0xBF54);
	*((int *) 0xBF54) = (var2 & (!(1 << arg2)));
	return;
}

/**
 * Subroutine at address 0x219C
 */
void sub_0219C (int arg1, int arg2, int arg3)
{
	var1 = *((int *) 0xBF54);
	*((int *) 0xBF54) = (var1 | (arg3 << arg2));
	return;
}

/**
 * Subroutine at address 0x21B8
 */
void sub_021B8 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	((int *) sp)[1] = ra;
	__asm__ ("mfc0			 $v0, COP0_22;"
		: "=r"(var1));
	var4 = sceSysreg_driver_F03852E0 (((var1 << 2) + 0xBFC00400));
	ra = ((int *) sp)[1];
	var5 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x21F8
 */
void sceSysreg_driver_0D2BE098 (int arg1, int arg2)
{
	var1 = 0x800001FE;
	if (!((((arg2 < arg1)) | (((arg1 < 0x0200)) ^ 1)) != 0))
	{
		if (!(arg2 == 0))
		{
			*((int *) 0xBC200000) = (((arg1 & 0x01FF) << 0x10) | (arg2 & 0x01FF));
			__asm__ ("sync;");
			var1 = 0;
		}
	}
	return;
}

/**
 * Subroutine at address 0x2240
 */
void sceSysreg_driver_B97B7828 (int arg1, int arg2)
{
	if (!(arg1 == 0))
	{
		var1 = *((int *) 0xBC200000);
		((int *) arg1)[0] = ((var1 >> 16) & 0x01FF);
	}
	if (!(arg2 == 0))
	{
		var2 = *((int *) 0xBC200000);
		((int *) arg2)[0] = (var2 & 0x01FF);
	}
	return;
}

/**
 * Subroutine at address 0x2278
 */
void sceSysreg_driver_3A930268 (int arg1, int arg2)
{
	var1 = 0x800001FE;
	if (!((((arg2 < arg1)) | (((arg1 < 0x0200)) ^ 1)) != 0))
	{
		if (!(arg2 == 0))
		{
			*((int *) 0xBC200004) = (((arg1 & 0x01FF) << 0x10) | (arg2 & 0x01FF));
			__asm__ ("sync;");
			var1 = 0;
		}
	}
	return;
}

/**
 * Subroutine at address 0x22C0
 */
void sceSysreg_driver_AB1EA306 (int arg1, int arg2)
{
	if (!(arg1 == 0))
	{
		var1 = *((int *) 0xBC200004);
		((int *) arg1)[0] = ((var1 >> 16) & 0x01FF);
	}
	if (!(arg2 == 0))
	{
		var2 = *((int *) 0xBC200004);
		((int *) arg2)[0] = (var2 & 0x01FF);
	}
	return;
}

/**
 * Subroutine at address 0x22F8
 */
void sceSysreg_driver_C387DAA3 ()
{
	sp = sp + 0xFFFFFFE0;
	__asm__ ("swc1			 $fpr20, 16($sp);"
		: 
		: "=r"(sp));
	((int *) sp)[0] = ra;
	__asm__ ("mov.s			$fpr20, $fpr12;");
	sceSysreg_driver_9AFD029D ();
	__asm__ ("lwc1			 $fpr03, -18000($t1);");
	__asm__ ("mul.s			$fpr02, $fpr20, $fpr03;"
					 "div.s			$fpr01, $fpr02, $fpr00;"
					 "trunc.w.s	$fpr00, $fpr01;"
					 "mfc1			 $t0, $fpr0;"
		: "=r"(var3));
	*((int *) 0xBC200000) = ((((MIN ((MAX (var3, 1)), 0x01FF)) & 0x01FF) << 0x10) | 0x01FF);
	__asm__ ("sync;");
	ra = ((int *) sp)[0];
	__asm__ ("lwc1			 $fpr20, 16($sp);");
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x2360
 */
void sceSysreg_driver_030EBAD6 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceSysreg_driver_9AFD029D ();
	var3 = *((int *) 0xBC200000);
	ra = ((int *) sp)[0];
	var4 = (var3 >> 16) & 0x01FF;
	__asm__ ("mtc1			 $v0, $fpr2;"
		: 
		: "=r"(var4));
	var5 = var3 & 0x01FF;
	__asm__ ("mtc1			 $v1, $fpr1;"
					 "cvt.s.w		$fpr05, $fpr02;"
					 "cvt.s.w		$fpr04, $fpr01;"
					 "mul.s			$fpr02, $fpr00, $fpr05;"
					 "div.s			$fpr00, $fpr02, $fpr04;"
		: 
		: "=r"(var5));
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x23A4
 */
void sceSysreg_driver_DB23A6B7 ()
{
	sp = sp + 0xFFFFFFE0;
	__asm__ ("swc1			 $fpr20, 16($sp);"
		: 
		: "=r"(sp));
	((int *) sp)[0] = ra;
	__asm__ ("mov.s			$fpr20, $fpr12;");
	sceSysreg_driver_9AFD029D ();
	__asm__ ("lwc1			 $fpr03, -17996($t1);");
	__asm__ ("mul.s			$fpr02, $fpr20, $fpr03;"
					 "div.s			$fpr01, $fpr02, $fpr00;"
					 "trunc.w.s	$fpr00, $fpr01;"
					 "mfc1			 $t0, $fpr0;"
		: "=r"(var3));
	*((int *) 0xBC200004) = ((((MIN ((MAX (var3, 1)), 0x01FF)) & 0x01FF) << 0x10) | 0x01FF);
	__asm__ ("sync;");
	ra = ((int *) sp)[0];
	__asm__ ("lwc1			 $fpr20, 16($sp);");
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x240C
 */
void sceSysreg_driver_F73DDE93 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceSysreg_driver_9AFD029D ();
	var3 = *((int *) 0xBC200004);
	ra = ((int *) sp)[0];
	var4 = (var3 >> 16) & 0x01FF;
	__asm__ ("mtc1			 $v1, $fpr5;"
		: 
		: "=r"(var4));
	var5 = (var3 & 0x01FF) << 1;
	__asm__ ("cvt.s.w		$fpr02, $fpr05;"
					 "mtc1			 $v0, $fpr3;"
					 "mul.s			$fpr01, $fpr00, $fpr02;"
					 "cvt.s.w		$fpr04, $fpr03;"
					 "div.s			$fpr00, $fpr01, $fpr04;"
		: 
		: "=r"(var5));
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2458
 */
void sceGpioInit ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	((int *) sp)[3] = ra;
	var1 = 0;
	var4 = KDebugForKernel_E892D9A1 ();
	if (!(var4 == 0))
	{
		var5 = ((int *) var4)[16];
		var8 var9 = (*var5) ();
		var1 = var8;
	}
	*((int *) 0xBF7C) = var1;
	sceSysreg_driver_2E9CF295 ();
	var12 = *((int *) 0xBE240000);
	var13 = *((int *) 0xBE240040);
	var14 = *((int *) 0xBE240010);
	var15 = *((int *) 0xBE240014);
	var16 = *((int *) 0xBE240018);
	var17 = *((int *) 0xBE24001C);
	var18 = var15 & var1;
	var19 = var17 & var1;
	var20 = var16 & var1;
	var21 = var14 & var1;
	*((int *) 0xBE240010) = var21;
	*((int *) 0xBF5C) = var12;
	*((int *) 0xBF78) = var13;
	*((int *) 0xBE240014) = var18;
	*((int *) 0xBF74) = 0;
	*((int *) 0xBE240018) = var20;
	*((int *) 0xBE24001C) = var19;
	*((int *) 0xBF80) = 0;
	*((int *) 0xBE240030) = 0;
	*((int *) 0xBF60) = var21;
	*((int *) 0xBF64) = var18;
	*((int *) 0xBF68) = var20;
	*((int *) 0xBF6C) = var19;
	*((int *) 0xBF70) = 0;
	*((int *) 0xBE240034) = 0;
	sceKernelRegisterIntrHandler (0x04, 2, 0x2EA0, 0, 0xBA60);
	sceKernelEnableIntr (0x04);
	sceKernelRegisterSysEventHandler (0xBD84);
	ra = ((int *) sp)[3];
	var28 = ((int *) sp)[2];
	var29 = ((int *) sp)[1];
	var30 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2580
 */
void sceGpioSetPortMode (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	((int *) sp)[1] = s1;
	var2 = 0x80000102;
	var3 = arg2;
	((int *) sp)[6] = ra;
	((int *) sp)[5] = s5;
	((int *) sp)[4] = s4;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	if (!(((arg1 < 0x20)) == 0))
	{
		if (arg2 == 1)
		{
			var4 = 0;
			var11 = 1;

		label10:
			var12 = 0;
			var15 = sceKernelCpuSuspendIntr ();
			var16 = *((int *) 0xBF5C);
			var17 = 1 << var1;
			if (!((var16 & var17) != 0))
			{
				var18 = *((int *) 0xBF78);
				var12 = !((var18 & var17)) ? 2 : 1;
			}
			var19 = *((int *) 0xBF5C);
			var20 = *((int *) 0xBF78);
			var21 = !(1 << var1);
			var22 = (var19 & var21) | (var4 << var1);
			var23 = (var20 & var21) | (var11 << var1);
			*((int *) 0xBF5C) = var22;
			*((int *) 0xBE240000) = var22;
			*((int *) 0xBF78) = var23;
			*((int *) 0xBE240040) = var23;
			if (var3 == 2)
			{
				sceSysreg_driver_C0D33340 (var1);
			}
			else
			{
				sceSysreg_driver_217316F7 (var1);
			}
			sceKernelCpuResumeIntr (var15);
			var2 = var12;
		}
		else
		{
			var4 = 1;
			if (((arg2 < 2)) != 0)
			{
				var11 = 0;
				if (arg2 == 0)
					goto label10;

			label23:
				var2 = 0x80000107;
			}
			else
			{
				if (!(var3 == 2))
					goto label23;
				var4 = 0;
				var11 = 0;
				goto label10;
			}
		}
	}
	ra = ((int *) sp)[6];
	var5 = ((int *) sp)[5];
	var6 = ((int *) sp)[4];
	var7 = ((int *) sp)[3];
	var8 = ((int *) sp)[2];
	var9 = ((int *) sp)[1];
	var10 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x26DC
 */
void sceGpio_driver_FF5E7843 (int arg1)
{
	var1 = 1 << arg1;
	if (!(((arg1 < 0x20)) == 0))
	{
		var2 = *((int *) 0xBF5C);
		var3 = 0;
		if (!((var2 & var1) != 0))
		{
			var4 = *((int *) 0xBF78);
			var3 = !((var4 & var1)) ? 2 : 1;
		}
	}
	return;
}

/**
 * Subroutine at address 0x272C
 */
void sceGpio_driver_54F1F60E (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	((int *) sp)[4] = ra;
	var2 = 0x80000102;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	if (!(((arg1 < 0x20)) == 0))
	{
		var2 = 0x80000107;
		if (!(((arg2 < 0x05)) == 0))
		{
			var3 = ((int *) ((arg2 << 2) + 0xBA6C))[0];
			switch () {
			case 0:
				var4 = 1;

			label12:
				var5 = 1;
				var6 = 0;

			label13:
				var9 = sceKernelCpuSuspendIntr ();
				var10 = *((int *) 0xBF60);
				var11 = *((int *) 0xBF64);
				var12 = *((int *) 0xBF68);
				var13 = !(1 << var1);
				*((int *) 0xBF68) = ((var12 & var13) | (var6 << var1));
				*((int *) 0xBF60) = ((var10 & var13) | (var4 << var1));
				*((int *) 0xBF64) = ((var11 & var13) | (var5 << var1));
				while (1) {
					var14 = *((int *) 0xBE240048);
					if ((var14 & 0x03) != 0)
						continue;
					break;
				}
				var15 = *((int *) 0xBE240010);
				var16 = *((int *) 0xBF7C);
				var17 = *((int *) 0xBF60);
				var18 = *((int *) 0xBF64);
				*((int *) 0xBE240010) = ((var15 & var16) | var17);
				var19 = *((int *) 0xBE240014);
				var20 = *((int *) 0xBF68);
				*((int *) 0xBE240014) = ((var19 & var16) | var18);
				var21 = *((int *) 0xBE240018);
				*((int *) 0xBE240018) = ((var21 & var16) | var20);
				*((int *) 0xBE240024) = (1 << var1);
				sceKernelCpuResumeIntrWithSync (var9);
				var2 = 0;
				goto label20;
			case 1:
				var4 = 1;

			label9:
				var5 = 0;

			label10:
				var6 = 1;
				goto label13;
			case 2:
				var4 = 0;
				goto label12;
			case 3:
				var4 = 0;
				goto label9;
			case 4:
				var4 = 0;
				var5 = 1;
				goto label10;
			}
		}
	}

label20:
	ra = ((int *) sp)[4];
	var24 = ((int *) sp)[3];
	var25 = ((int *) sp)[2];
	var26 = ((int *) sp)[1];
	var27 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x28C0
 */
void sceGpio_driver_29F152C3 (int arg1)
{
	var1 = *((int *) 0xBF60);
	var2 = *((int *) 0xBF64);
	var3 = *((int *) 0xBF68);
	var4 = (var2 >> arg1) & 1;
	var5 = (var4 < 1);
	if (!(((var1 >> arg1) & 1) != 0))
	{
		var5 = 0x04;
		if (!((var4 & ((var3 >> arg1) & 1)) != 0))
		{
			var5 = !(var4) ? 0x03 : 2;
		}
	}
	return;
}

/**
 * Subroutine at address 0x2934
 */
void sub_02934 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceKernelUnregisterSysEventHandler (0xBD84);
	sceKernelReleaseIntrHandler (0x04);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2960
 */
void sceGpioEnd ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceKernelUnregisterSysEventHandler (0xBD84);
	sceKernelReleaseIntrHandler (0x04);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x298C
 */
void sceGpioSuspend ()
{
	return;
}

/**
 * Subroutine at address 0x2994
 */
void sceGpioResume ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceSysreg_driver_2E9CF295 ();
	var3 = *((int *) 0xBE240000);
	*((int *) 0xBF5C) = var3;
	var4 = *((int *) 0xBE240040);
	ra = ((int *) sp)[0];
	*((int *) 0xBF78) = var4;
	*((int *) 0xBF74) = 0;
	*((int *) 0xBF6C) = 0;
	*((int *) 0xBF60) = 0;
	*((int *) 0xBF64) = 0;
	*((int *) 0xBF68) = 0;
	*((int *) 0xBF70) = 0;
	*((int *) 0xBE24001C) = 0;
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x29FC
 */
void sceGpio_driver_A908E0BE ()
{
	var1 = *((int *) 0xBE240004);
	return;
}

/**
 * Subroutine at address 0x2A0C
 */
void sceGpioPortSet (int arg1)
{
	*((int *) 0xBE240008) = arg1;
	__asm__ ("sync;");
	return;
}

/**
 * Subroutine at address 0x2A24
 */
void sceGpioPortClear (int arg1)
{
	*((int *) 0xBE24000C) = arg1;
	__asm__ ("sync;");
	return;
}

/**
 * Subroutine at address 0x2A3C
 */
void sceGpio_driver_010628FC (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = ra;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = arg1;
	var4 = sceKernelCpuSuspendIntr ();
	var5 = *((int *) 0xBE240004);
	*((int *) 0xBE24000C) = (var5 & var1);
	*((int *) 0xBE240008) = ((!var5) & var1);
	sceKernelCpuResumeIntr (var4, 0xBE240000, 0xBE240008);
	ra = ((int *) sp)[2];
	var8 = ((int *) sp)[1];
	var9 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2AA4
 */
void sceGpio_driver_66995E31 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	var1 = arg1;
	((int *) sp)[0] = s0;
	var2 = 0x80000102;
	((int *) sp)[2] = ra;
	if (!(((arg1 < 0x20)) == 0))
	{
		var5 = sceKernelCpuSuspendIntr ();
		var6 = *((int *) 0xBF6C);
		var7 = *((int *) 0xBE24001C);
		var8 = *((int *) 0xBF7C);
		var9 = var6 | (1 << var1);
		*((int *) 0xBE24001C) = ((var7 & var8) | var9);
		var2 = (var6 >> var1) & 1;
		*((int *) 0xBF6C) = var9;
		sceKernelCpuResumeIntr (var5, var8);
	}
	ra = ((int *) sp)[2];
	var12 = ((int *) sp)[1];
	var13 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2B30
 */
void sceGpioDisableIntr (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	var1 = arg1;
	((int *) sp)[0] = s0;
	var2 = 0x80000102;
	((int *) sp)[2] = ra;
	if (!(((arg1 < 0x20)) == 0))
	{
		var5 = sceKernelCpuSuspendIntr ();
		var6 = *((int *) 0xBF6C);
		var7 = *((int *) 0xBE24001C);
		var8 = *((int *) 0xBF7C);
		var9 = var6 & (!(1 << var1));
		*((int *) 0xBE24001C) = ((var7 & var8) | var9);
		var2 = (var6 >> var1) & 1;
		*((int *) 0xBF6C) = var9;
		sceKernelCpuResumeIntr (var5, var8);
	}
	ra = ((int *) sp)[2];
	var12 = ((int *) sp)[1];
	var13 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2BC0
 */
void sceGpio_driver_EBDE13F6 (int arg1)
{
	var1 = 0x80000102;
	if (!(((arg1 < 0x20)) == 0))
	{
		var2 = *((int *) 0xBE240020);
		var1 = (var2 >> arg1) & 1;
	}
	return;
}

/**
 * Subroutine at address 0x2BEC
 */
void sceGpio_driver_7D484D6F (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	var1 = arg1;
	((int *) sp)[0] = s0;
	var2 = 0x80000102;
	((int *) sp)[2] = ra;
	if (!(((arg1 < 0x20)) == 0))
	{
		var5 = sceKernelCpuSuspendIntr ();
		var6 = *((int *) 0xBE240020);
		var2 = (var6 >> var1) & 1;
		*((int *) 0xBE240024) = (var2 << var1);
		sceKernelCpuResumeIntrWithSync (var5);
	}
	ra = ((int *) sp)[2];
	var9 = ((int *) sp)[1];
	var10 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2C54
 */
void sceGpio_driver_D4BC4C75 (int arg1)
{
	if (!(((arg1 < 0x04)) == 0))
	{
		var1 = *((int *) 0xBF70);
	}
	return;
}

/**
 * Subroutine at address 0x2C80
 */
void sceGpio_driver_EE787A33 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	var1 = arg2;
	((int *) sp)[0] = s0;
	((int *) sp)[3] = ra;
	if (((((arg1 < 0x04)) ^ 1) | (arg2 >> 0x1F)) != 0)
	{

	label9:
	}
	else
	{
		if (!(((var1 < 0x20)) != 0))
			goto label9;
		var7 = sceKernelCpuSuspendIntr ();
		var8 = *((int *) 0xBF70);
		var9 = arg1 << 0x03;
		var10 = (var8 & (!(0x1F << var9))) | (var1 << var9);
		*((int *) 0xBF70) = var10;
		*((int *) 0xBE240030) = var10;
		sceKernelCpuResumeIntrWithSync (var7);
	}
	ra = ((int *) sp)[3];
	var2 = ((int *) sp)[2];
	var3 = ((int *) sp)[1];
	var4 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2D30
 */
void sceGpio_driver_23A7C62C (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	var2 = 0x80000102;
	((int *) sp)[1] = ra;
	if (!(((arg1 < 0x04)) == 0))
	{
		var5 = sceKernelCpuSuspendIntr ();
		var6 = *((int *) 0xBF74);
		var7 = var6 | (1 << var1);
		*((int *) 0xBF74) = var7;
		*((int *) 0xBE240034) = var7;
		sceKernelCpuResumeIntrWithSync (var5);
		var2 = ((var6 >> var1) & 1);
	}
	ra = ((int *) sp)[1];
	var10 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2DA4
 */
void sceGpio_driver_D130755B (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	var1 = arg1;
	((int *) sp)[0] = s0;
	var2 = 0x80000102;
	((int *) sp)[2] = ra;
	if (!(((arg1 < 0x04)) == 0))
	{
		var5 = sceKernelCpuSuspendIntr ();
		var6 = *((int *) 0xBF74);
		var7 = var6 & (!(1 << var1));
		*((int *) 0xBF74) = var7;
		var2 = (var6 >> var1) & 1;
		*((int *) 0xBE240034) = var7;
		sceKernelCpuResumeIntrWithSync (var5);
	}
	ra = ((int *) sp)[2];
	var10 = ((int *) sp)[1];
	var11 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2E20
 */
void sub_02E20 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	if (arg1 == 0x4002)
	{

	label7:
		ra = ((int *) sp)[0];
	}
	else
	{
		if (!(arg1 == 0x00010002))
			goto label7;
		sceSysreg_driver_2E9CF295 ();
		var3 = *((int *) 0xBE240000);
		var4 = *((int *) 0xBE240040);
		*((int *) 0xBF78) = var4;
		*((int *) 0xBF74) = 0;
		*((int *) 0xBF6C) = 0;
		*((int *) 0xBF60) = 0;
		*((int *) 0xBF64) = 0;
		*((int *) 0xBF68) = 0;
		*((int *) 0xBF70) = 0;
		*((int *) 0xBF5C) = var3;
		*((int *) 0xBE24001C) = 0;
		ra = ((int *) sp)[0];
	}
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2EA0
 */
void sub_02EA0 (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var1 = *((int *) 0xBE24001C);
	var2 = *((int *) 0xBF7C);
	var3 = *((int *) 0xBE240020);
	var4 = (var1 & var3) & (!var2);
	if (var4 != 0)
	{
		var5 = *((int *) 0xBF80);
		*((int *) 0xBF80) = ((var5 + 1) & 0x1F);
		var6 = ((var5 - (CLZ ((ROTV (var5, var4))))) + 0x1F) & 0x1F;
		*((int *) 0xBE240024) = (1 << var6);
		InterruptManagerForKernel_8BE96A2E (arg1, var6, var6, arg3);
		ra = ((int *) sp)[0];
	}
	else
	{
		ra = ((int *) sp)[0];
	}
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x2F30
 */
void sub_02F30 (int arg1, int arg2)
{
	var1 = *((int *) 0xBF6C);
	var2 = var1 | (1 << arg2);
	*((int *) 0xBF6C) = var2;
	var3 = *((int *) 0xBF7C);
	var4 = *((int *) 0xBE24001C);
	*((int *) 0xBE24001C) = ((var4 & var3) | var2);
	return;
}

/**
 * Subroutine at address 0x2F70
 */
void sub_02F70 (int arg1, int arg2)
{
	var1 = *((int *) 0xBF6C);
	var2 = var1 & (!(1 << arg2));
	*((int *) 0xBF6C) = var2;
	var3 = *((int *) 0xBF7C);
	var4 = *((int *) 0xBE24001C);
	*((int *) 0xBE24001C) = ((var4 & var3) | var2);
	return;
}

/**
 * Subroutine at address 0x2FB4
 */
void sub_02FB4 (int arg1, int arg2, int arg3)
{
	if (!(arg3 == 0))
	{
		var1 = *((int *) 0xBF6C);
		((int *) arg3)[0] = ((var1 >> arg2) & 1);
	}
	var2 = *((int *) 0xBE24001C);
	var3 = *((int *) 0xBF6C);
	var4 = *((int *) 0xBF7C);
	var5 = var3 & (!(1 << arg2));
	*((int *) 0xBE24001C) = ((var2 & var4) | var5);
	*((int *) 0xBF6C) = var5;
	return;
}

/**
 * Subroutine at address 0x3010
 */
void sub_03010 (int arg1, int arg2, int arg3)
{
	var1 = *((int *) 0xBF6C);
	var2 = var1 | (arg3 << arg2);
	*((int *) 0xBF6C) = var2;
	var3 = *((int *) 0xBF7C);
	var4 = *((int *) 0xBE24001C);
	*((int *) 0xBE24001C) = ((var4 & var3) | var2);
	return;
}

/**
 * Subroutine at address 0x304C
 */
void sub_0304C (int arg1, int arg2)
{
	var1 = *((int *) 0xBE240020);
	return;
}

/**
 * Subroutine at address 0x3064
 */
void scePwm_driver_19D581D3 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceSysreg_driver_8684E7A1 ();
	sceSysreg_driver_6B5C5FD0 ();
	var5 = 0xBF84;
	var6 = 0xBE300000;
	var7 = 2;
	while (1) {
		var8 = ((int *) var6)[1];
		if ((var8 & 1) == 0)
		{
			((char *) var5)[0] = 0;
		}
		else
		{
			((char *) var5)[0] = 1;
		}
		var7 = var7 + 0xFFFFFFFF;
		var6 = var6 + 0x20;
		var5 = var5 + 1;
		if (var7 >= 0)
			continue;
		break;
	}
	sceKernelRegisterSysEventHandler (0xBDC4);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x30D0
 */
void scePwm_driver_7B35F776 (int arg1, int arg2, int arg3, int arg4)
{
	var1 = 0x80000102;
	if (!(((arg1 < 0x03)) == 0))
	{
		var2 = (arg1 << 0x05) + 0xBE300000;
		while (1) {
			var3 = ((int *) var2)[0];
			if ((var3 & 0x8000) != 0)
				continue;
			break;
		}
		var4 = ((unsigned char *) (arg1 + 0xBF84))[0];
		if (var4 == 2)
		{
			var5 = ((int *) var2)[1];
			var1 = 0x80000021;
			if (!((var5 & 1) != 0))
			{
				var4 = 0;

			label8:
				((char *) (arg1 + 0xBF84))[0] = 1;
				var1 = var4;
				((int *) var2)[0] = (arg2 & 0x3F);
				((int *) var2)[4] = (arg3 & 0xFFFF);
				((int *) var2)[5] = (arg4 & 0xFFFF);
				((int *) var2)[2] = 1;
				((int *) var2)[1] = 1;
			}
		}
		else
		goto label8;
	}
	return;
}

/**
 * Subroutine at address 0x3170
 */
void scePwm_driver_43799573 (int arg1)
{
	var1 = arg1;
	var2 = arg1 + 0xBF84;
	var3 = (var1 << 0x05) + 0xBE300000;
	var4 = 0x80000102;
	if (!(((var1 < 0x03)) == 0))
	{
		var5 = ((unsigned char *) var2)[0];
		var6 = var2;
		var4 = 0;
		if (var5 == 2)
		{
			var8 = ((int *) var3)[1];
			if (!((var8 & 1) != 0))
			{
				((char *) var2)[0] = 0;
				var5 = 0;
			}
		}
		if (!(var5 == 0))
		{
			((int *) var3)[1] = 0;
			var4 = var5;
			((char *) var6)[0] = 2;
			var7 = ((int *) var3)[1];
			if ((var7 & 1) == 0)
			{
				((char *) var6)[0] = 0;
			}
		}
	}
	return;
}

/**
 * Subroutine at address 0x31F8
 */
void scePwm_driver_91C21CC0 (int arg1, int arg2, int arg3)
{
	var1 = 0x80000102;
	if (!(((arg1 < 0x03)) == 0))
	{
		var2 = ((unsigned char *) (arg1 + 0xBF84))[0];
		var3 = (arg1 << 0x05) + 0xBE300000;
		var1 = 0x80000021;
		if (!(var2 == 2))
		{
			((int *) var3)[4] = (arg2 & 0xFFFF);
			var1 = 0;
			((int *) var3)[5] = (arg3 & 0xFFFF);
			((int *) var3)[2] = 1;
		}
	}
	return;
}

/**
 * Subroutine at address 0x3258
 */
void scePwm_driver_965DD38D (int arg1, int arg2, int arg3, int arg4)
{
	var1 = 0x80000102;
	if (!(((arg1 < 0x03)) == 0))
	{
		var2 = (arg1 << 0x05) + 0xBE300000;
		if (!(arg2 == 0))
		{
			var3 = ((int *) var2)[4];
			((short *) arg2)[0] = var3;
		}
		if (!(arg3 == 0))
		{
			var4 = ((int *) var2)[5];
			((short *) arg3)[0] = var4;
		}
		if (!(arg4 == 0))
		{
			var5 = ((int *) var2)[3];
			((int *) arg4)[0] = var5;
		}
		var6 = arg1 + 0xBF84;
		var7 = ((unsigned char *) var6)[0];
		if (var7 == 2)
		{
			var8 = ((int *) var2)[1];
			if ((var8 & 1) == 0)
			{
				((char *) var6)[0] = 0;
			}
			var7 = 0;
		}
		var1 = var7;
	}
	return;
}

/**
 * Subroutine at address 0x32E0
 */
void scePwm_driver_F3FA2FD7 (int arg1)
{
	if (!(((arg1 < 0x03)) == 0))
	{
		var1 = ((int *) ((arg1 << 0x05) + 0xBE300000))[2];
	}
	return;
}
void sub_0332C ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceKernelUnregisterSysEventHandler (0xBDC4);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x3350
 */
void scePwm_driver_BF8793AF ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceKernelUnregisterSysEventHandler (0xBDC4);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x3374
 */
void scePwm_driver_117678BA ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceSysreg_driver_80995BB5 ();
	sceSysreg_driver_03BD35E5 ();
	var5 = 0;
	while (1) {
		var5 = var5 + 1;
		((char *) (var5 + 0xBF84))[0] = 0;
		if (((var5 < 0x03)) != 0)
			continue;
		break;
	}
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x33BC
 */
void scePwm_driver_99B6802D ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	sceSysreg_driver_8684E7A1 ();
	sceSysreg_driver_6B5C5FD0 ();
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x33E4
 */
void scePwm_driver_E5C8190D (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	scePwm_driver_965DD38D (arg1, arg2, arg3, 0);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x3400
 */
void sub_03400 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	if (arg1 == 0x4004)
	{
		sceSysreg_driver_80995BB5 ();
		sceSysreg_driver_03BD35E5 ();
		var9 = 0;
		while (1) {
			var9 = var9 + 1;
			((char *) (var9 + 0xBF84))[0] = 0;
			if (((var9 < 0x03)) != 0)
				continue;
			break;
		}
		ra = ((int *) sp)[0];
	}
	else
	{
		if (arg1 == 0x00010004)
		{
			sceSysreg_driver_8684E7A1 ();
			sceSysreg_driver_6B5C5FD0 ();
			ra = ((int *) sp)[0];
		}
		else
		{
			ra = ((int *) sp)[0];
		}
	}
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x3480
 */
void sub_03480 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	if (arg1 == 0x400F)
	{
		*((int *) 0xBF90) = 1;

	label23:
	}
	else
	{
		if (((arg1 < 0x4010)) == 0)
		{
			if (arg1 == 0x00010004)
			{
				sceSysreg_driver_04839CA2 ();
				sceSysreg_driver_23944179 ();
				var10 = *((int *) 0xBFA0);
				var11 = *((int *) 0xBF9C);
				sceI2c_driver_EF4EF213 (var11, var10);
			}
			else
			{
				if (!(arg1 != 0x00040000))
				{
					*((int *) 0xBF90) = 0;
				}
			}
		}
		else
		{
			if (arg1 == 0x0402)
			{
				var5 = *((int *) 0xBF94);
			}
			else
			{
				if (!(arg1 == 0x4004))
					goto label23;
				sceSysreg_driver_6D204F2A ();
				sceSysreg_driver_917F9660 ();
			}
		}
	}
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x3548
 */
void sceI2c_driver_EF4EF213 (int arg1, int arg2)
{
	*((int *) 0xBFA0) = arg2;
	*((int *) 0xBF9C) = arg1;
	return;
}

/**
 * Subroutine at address 0x3560
 */
void sceI2c_driver_48674B64 (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFD0;
	((int *) sp)[5] = s1;
	var1 = arg3;
	((int *) sp)[8] = s4;
	var2 = 0x80000104;
	var3 = arg1;
	((int *) sp)[6] = s2;
	var4 = arg2;
	((int *) sp)[9] = ra;
	((int *) sp)[7] = s3;
	((int *) sp)[4] = s0;
	if (!(((arg3 < 0x10)) == 0))
	{
		var5 = *((int *) 0xBF90);
		if (var5 == 0)
		{
			var67 = *((int *) 0xBF8C);
			var70 = sceKernelLockMutex (var67, 1, 0);
			var2 = var70;
			if (var70 >= 0)
			{

			label9:
				*((int *) 0xBF94) = 1;
				var2 = 0;
			}
			else
			{
			}
		}
		else
		goto label9;
		if (!(var2 < 0))
		{
			var6 = *((int *) 0xBF98);
			if (var6 != 0)
			{
				var62 = ((int *) var6)[1];
				var65 var66 = (*var62) (var3, var4, var1, 0xBF88, arg5, arg6, arg7, arg8);
			}
			sub_047E4 ();
			var9 = *((int *) 0xBE200008);
			if ((var9 & 0x8000) != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var61 = *((int *) 0xBE200008);
					if ((var61 & 0x8000) != 0)
						continue;
					break;
				}
			}
			*((int *) 0xBE200008) = var1;
			var10 = *((int *) 0xBE200008);
			if ((var10 & 0x8000) != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var58 = *((int *) 0xBE200008);
					if ((var58 & 0x8000) != 0)
						continue;
					break;
				}
			}
			*((int *) 0xBE20000C) = var3;
			var11 = 0;
			if (!(var1 <= 0))
			{
				var12 = var4 + 0;
				while (1) {
					var13 = ((unsigned char *) var12)[0];
					var11 = var11 + 1;
					*((int *) 0xBE20000C) = var13;
					var12 = var4 + var11;
					if (((var11 < var1)) != 0)
						continue;
					break;
				}
			}
			var14 = *((int *) 0xBE200004);
			if ((var14 & 0x8000) != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var55 = *((int *) 0xBE200004);
					if ((var55 & 0x8000) != 0)
						continue;
					break;
				}
			}
			*((int *) 0xBE200004) = 0x87;
			var15 = *((int *) 0xBE200004);
			var16 = var15 & 0x8000;
			if (var16 != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var52 = *((int *) 0xBE200004);
					if ((var52 & 0x8000) != 0)
						continue;
					break;
				}
				var17 = *((int *) 0xBF90);
			}
			else
			{
				var17 = *((int *) 0xBF90);
			}
			if (var17 == 0)
			{
				sceKernelEnableIntr (0x0C);
				var43 = *((int *) 0xBF88);
				var44 = sp;
				var47 = sceKernelWaitEventFlag (var43, 1, 0x11, var44, 0);
				sceKernelDisableIntr (0x0C);
				var18 = *((unsigned short *) 0xBFA4);
			}
			else
			{
				var18 = *((unsigned short *) 0xBFA4);
			}
			var19 = *((int *) 0xBF98);
			var20 = var18 & 0x20;
			var21 = !(var20) ? 0 : 0x803F4900;
			if (var19 != 0)
			{
				var36 = ((int *) var19)[2];
				var39 var40 = (*var36) (var18, var16, 0x87);
			}
			*((int *) 0xBE20001C) = 0;
			var22 = *((int *) 0xBE20001C);
			if ((var22 & 0x8000) != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var35 = *((int *) 0xBE20001C);
					if ((var35 & 0x8000) != 0)
						continue;
					break;
				}
				var23 = *((int *) 0xBF90);
			}
			else
			{
				var23 = *((int *) 0xBF90);
			}
			if (var23 == 0)
			{
				var29 = *((int *) 0xBF8C);
				var32 = sceKernelUnlockMutex (var29, 1);
				if (var32 >= 0)
				{
					*((int *) 0xBF94) = 0;

				label69:
					var2 = var21;
				}
				else
				{
					var2 = var21;
				}
			}
			else
			{
				*((int *) 0xBF94) = 0;
				goto label69;
			}
		}
	}
	ra = ((int *) sp)[9];
	var24 = ((int *) sp)[8];
	var25 = ((int *) sp)[7];
	var26 = ((int *) sp)[6];
	var27 = ((int *) sp)[5];
	var28 = ((int *) sp)[4];
	sp = sp + 0x30;
	return;
}

/**
 * Subroutine at address 0x3828
 */
void sceI2c_driver_FE95ACD7 (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFD0;
	((int *) sp)[9] = s5;
	var1 = arg3 + 0xFFFFFFFF;
	((int *) sp)[5] = s1;
	var2 = arg3;
	((int *) sp)[7] = s3;
	var3 = 0x80000104;
	var4 = arg2;
	((int *) sp)[4] = s0;
	var5 = arg1;
	((int *) sp)[10] = ra;
	((int *) sp)[8] = s4;
	((int *) sp)[6] = s2;
	if (!(((var1 < 0x10)) == 0))
	{
		var6 = *((int *) 0xBF90);
		if (var6 == 0)
		{
			var129 = *((int *) 0xBF8C);
			var132 = sceKernelLockMutex (var129, 1, 0);
			var7 = var132;
			if (var132 >= 0)
			{

			label9:
				*((int *) 0xBF94) = 1;
				var7 = 0;
			}
			else
			{
			}
		}
		else
		goto label9;
		var3 = var7;
		if (!(var7 < 0))
		{
			var8 = *((int *) 0xBF98);
			if (var8 != 0)
			{
				var124 = ((int *) var8)[3];
				var127 var128 = (*var124) (var5, var2, 0xBF88, arg4, arg5, arg6, arg7, arg8);
			}
			sub_047E4 ();
			var11 = *((int *) 0xBE200008);
			var12 = var11 & 0x8000;
			if (var12 != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var123 = *((int *) 0xBE200008);
					if ((var123 & 0x8000) != 0)
						continue;
					break;
				}
			}
			*((int *) 0xBE200008) = 0;
			var13 = *((int *) 0xBE200008);
			var14 = var13 & 0x8000;
			var15 = var5 | 1;
			if (var14 != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var120 = *((int *) 0xBE200008);
					var15 = var5 | 1;
					if ((var120 & 0x8000) != 0)
						continue;
					break;
				}
			}
			*((int *) 0xBE20000C) = var15;
			var16 = *((int *) 0xBE200004);
			if ((var16 & 0x8000) != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var117 = *((int *) 0xBE200004);
					if ((var117 & 0x8000) != 0)
						continue;
					break;
				}
			}
			*((int *) 0xBE200004) = 0x85;
			var17 = *((int *) 0xBE200004);
			if ((var17 & 0x8000) != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var114 = *((int *) 0xBE200004);
					if ((var114 & 0x8000) != 0)
						continue;
					break;
				}
				var18 = *((int *) 0xBF90);
			}
			else
			{
				var18 = *((int *) 0xBF90);
			}
			if (var18 == 0)
			{
				sceKernelEnableIntr (0x0C);
				var105 = *((int *) 0xBF88);
				var106 = sp;
				var109 = sceKernelWaitEventFlag (var105, 1, 0x11, var106, 0);
				sceKernelDisableIntr (0x0C);
				var19 = *((unsigned short *) 0xBFA4);
			}
			else
			{
				var19 = *((unsigned short *) 0xBFA4);
			}
			var20 = var19 & 0x20;
			if (var20 != 0)
			{
				var88 = *((int *) 0xBF98);
				if (var88 != 0)
				{
					var98 = ((int *) var88)[4];
					var101 var102 = (*var98) (var19, 0, 0, var12, var11, var20);
				}
				*((int *) 0xBE20001C) = 0;
				var89 = *((int *) 0xBE20001C);
				if ((var89 & 0x8000) != 0)
				{
					while (1) {
						sceKernelDelayThread (0x64);
						var97 = *((int *) 0xBE20001C);
						if ((var97 & 0x8000) != 0)
							continue;
						break;
					}
					var90 = *((int *) 0xBF90);
				}
				else
				{
					var90 = *((int *) 0xBF90);
				}
				if (var90 == 0)
				{
					var91 = *((int *) 0xBF8C);
					var94 = sceKernelUnlockMutex (var91, 1);
					if (var94 >= 0)
					{
						*((int *) 0xBF94) = 0;

					label69:
					}
					else
					{
					}
				}
				else
				{
					*((int *) 0xBF94) = 0;
					goto label69;
				}
				var3 = 0x803F4900;
			}
			else
			{
				var21 = *((int *) 0xBE200008);
				if ((var21 & 0x8000) != 0)
				{
					while (1) {
						sceKernelDelayThread (0x64);
						var87 = *((int *) 0xBE200008);
						if ((var87 & 0x8000) != 0)
							continue;
						break;
					}
				}
				*((int *) 0xBE200008) = var1;
				var22 = *((int *) 0xBE200008);
				if ((var22 & 0x8000) != 0)
				{
					while (1) {
						sceKernelDelayThread (0x64);
						var84 = *((int *) 0xBE200008);
						if ((var84 & 0x8000) != 0)
							continue;
						break;
					}
				}
				var23 = *((int *) 0xBE200004);
				if ((var23 & 0x8000) != 0)
				{
					while (1) {
						sceKernelDelayThread (0x64);
						var81 = *((int *) 0xBE200004);
						if ((var81 & 0x8000) != 0)
							continue;
						break;
					}
				}
				*((int *) 0xBE200004) = 0x8A;
				var24 = *((int *) 0xBE200004);
				var25 = var24 & 0x8000;
				if (var25 != 0)
				{
					while (1) {
						sceKernelDelayThread (0x64);
						var78 = *((int *) 0xBE200004);
						if ((var78 & 0x8000) != 0)
							continue;
						break;
					}
					var26 = *((int *) 0xBF90);
				}
				else
				{
					var26 = *((int *) 0xBF90);
				}
				if (var26 == 0)
				{
					sceKernelEnableIntr (0x0C);
					var69 = *((int *) 0xBF88);
					var70 = sp + 0x04;
					var73 = sceKernelWaitEventFlag (var69, 1, 0x11, var70, 0);
					sceKernelDisableIntr (0x0C);
					var27 = *((unsigned short *) 0xBFA4);
				}
				else
				{
					var27 = *((unsigned short *) 0xBFA4);
				}
				if ((var27 & 0x20) != 0)
				{
					var52 = *((int *) 0xBF98);
					if (var52 != 0)
					{
						var62 = ((int *) var52)[4];
						var65 var66 = (*var62) (var27, 0, 1, var12, var25, 0x8A);
					}
					*((int *) 0xBE20001C) = 0;
					var53 = *((int *) 0xBE20001C);
					if ((var53 & 0x8000) != 0)
					{
						while (1) {
							sceKernelDelayThread (0x64);
							var61 = *((int *) 0xBE20001C);
							if ((var61 & 0x8000) != 0)
								continue;
							break;
						}
						var54 = *((int *) 0xBF90);
					}
					else
					{
						var54 = *((int *) 0xBF90);
					}
					if (var54 == 0)
					{
						var55 = *((int *) 0xBF8C);
						var58 = sceKernelUnlockMutex (var55, 1);
						if (var58 >= 0)
						{
							*((int *) 0xBF94) = 0;

						label122:
						}
						else
						{
						}
					}
					else
					{
						*((int *) 0xBF94) = 0;
						goto label122;
					}
					var3 = 0x803F4901;
				}
				else
				{
					var28 = 0;
					if (!(var2 <= 0))
					{
						while (1) {
							var29 = *((int *) 0xBE20000C);
							var28 = var28 + 1;
							((char *) (var4 + var28))[0] = var29;
							if (((var28 < var2)) != 0)
								continue;
							break;
						}
					}
					var30 = *((int *) 0xBF98);
					if (var30 != 0)
					{
						var46 = *((unsigned short *) 0xBFA4);
						var47 = ((int *) var30)[4];
						var50 var51 = (*var47) (var46, var4, var2, var12, var25, 0x8A);
					}
					*((int *) 0xBE20001C) = 0;
					var31 = *((int *) 0xBE20001C);
					if ((var31 & 0x8000) != 0)
					{
						while (1) {
							sceKernelDelayThread (0x64);
							var45 = *((int *) 0xBE20001C);
							if ((var45 & 0x8000) != 0)
								continue;
							break;
						}
						var32 = *((int *) 0xBF90);
					}
					else
					{
						var32 = *((int *) 0xBF90);
					}
					if (var32 == 0)
					{
						var39 = *((int *) 0xBF8C);
						var42 = sceKernelUnlockMutex (var39, 1);
						if (var42 >= 0)
						{
							*((int *) 0xBF94) = 0;

						label145:
							var3 = var7;
						}
						else
						{
							var3 = var7;
						}
					}
					else
					{
						*((int *) 0xBF94) = 0;
						goto label145;
					}
				}
			}
		}
	}
	ra = ((int *) sp)[10];
	var33 = ((int *) sp)[9];
	var34 = ((int *) sp)[8];
	var35 = ((int *) sp)[7];
	var36 = ((int *) sp)[6];
	var37 = ((int *) sp)[5];
	var38 = ((int *) sp)[4];
	sp = sp + 0x30;
	return;
}
void sceI2c_driver_ECE95479 (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6){
	var1 = arg3;
	var2 = arg6;
	var3 = (var2 < 1);
	var4 = (((arg3 + 0xFFFFFFFF) < 0x0F)) ^ 1;
	var5 = arg4;
	var6 = arg5;
	var7 = arg1;
	var8 = arg2;
	if (var4 | var3)return;
	if (var2>=0x11)return;
	ret = 0;
	if (*((int *) 0xBF90))*((int *) 0xBF94) = 1;
	else if ((ret=sceKernelLockMutex (*((int *) 0xBF8C), 1, 0)) >= 0)
		*((int *) 0xBF94) = 1;
	if (ret<0)return;
	if (*((int *) 0xBF98))
		(*(*((int *) 0xBF98))[5]) (var7, var8, arg3, var5, var2, var4, var3, 1);
	sub_047E4 ();
	while ((*((int *) 0xBE200008) & 0x8000))
		sceKernelDelayThread (0x64);
	*((int *) 0xBE200008) = arg3;
	while ((*((int *) 0xBE200008) & 0x8000))
		sceKernelDelayThread (0x64);
	*((int *) 0xBE20000C) = var7;
	var25 = var8;
	while (var1 > 0) {
		*((int *) 0xBE20000C) = ((unsigned char *) var25)[0];
		var25++;
	}
	var27 = *((int *) 0xBE200004);
	if ((var27 & 0x8000) != 0)
	{
		while (1) {
			sceKernelDelayThread (0x64);
			var162 = *((int *) 0xBE200004);
			if ((var162 & 0x8000) != 0)
				continue;
			break;
		}
	}
	*((int *) 0xBE200004) = 0x85;
	var28 = *((int *) 0xBE200004);
	var29 = var28 & 0x8000;
	if (var29 != 0)
	{
		while (1) {
			sceKernelDelayThread (0x64);
			var159 = *((int *) 0xBE200004);
			if ((var159 & 0x8000) != 0)
				continue;
			break;
		}
		var30 = *((int *) 0xBF90);
	}
	else
	{
		var30 = *((int *) 0xBF90);
	}
	if (var30 == 0)
	{
		sceKernelEnableIntr (0x0C);
		var150 = *((int *) 0xBF88);
		var151 = sp;
		var154 = sceKernelWaitEventFlag (var150, 1, 0x11, var151, 0);
		sceKernelDisableIntr (0x0C);
		var31 = *((unsigned short *) 0xBFA4);
	}
	else
	{
		var31 = *((unsigned short *) 0xBFA4);
	}
	if ((var31 & 0x20) != 0)
	{
		var138 = *((int *) 0xBF98);
		if (var138 != 0)
		{
			var143 = ((int *) var138)[6];
			var146 var147 = (*var143) (var31, 0, 0, var29, var28);
		}
		*((int *) 0xBE20001C) = 0;
		var139 = *((int *) 0xBE20001C);
		if ((var139 & 0x8000) == 0)
		{
		}
		else
		{
			while (1) {
				sceKernelDelayThread (0x64);
				var142 = *((int *) 0xBE20001C);
				if ((var142 & 0x8000) != 0)
					continue;
				break;
			}
		}

	label107:
		var104 = *((int *) 0xBF90);

	label108:
		if (var104 == 0)
		{
			var105 = *((int *) 0xBF8C);
			var108 = sceKernelUnlockMutex (var105, 1);
			if (var108 >= 0)
			{
				*((int *) 0xBF94) = 0;

			label116:
			}
			else
			{
			}
		}
		else
		{
			*((int *) 0xBF94) = 0;
			goto label116;
		}
	}
	else
	{
		var32 = *((int *) 0xBE200008);
		if ((var32 & 0x8000) != 0)
		{
			while (1) {
				sceKernelDelayThread (0x64);
				var137 = *((int *) 0xBE200008);
				if ((var137 & 0x8000) != 0)
					continue;
				break;
			}
		}
		*((int *) 0xBE200008) = 0;
		var33 = *((int *) 0xBE200008);
		var34 = var5 | 1;
		if ((var33 & 0x8000) != 0)
		{
			while (1) {
				sceKernelDelayThread (0x64);
				var134 = *((int *) 0xBE200008);
				var34 = var5 | 1;
				if ((var134 & 0x8000) != 0)
					continue;
				break;
			}
		}
		*((int *) 0xBE20000C) = var34;
		var35 = *((int *) 0xBE200004);
		if ((var35 & 0x8000) != 0)
		{
			while (1) {
				sceKernelDelayThread (0x64);
				var131 = *((int *) 0xBE200004);
				if ((var131 & 0x8000) != 0)
					continue;
				break;
			}
		}
		*((int *) 0xBE200004) = 0x85;
		var36 = *((int *) 0xBE200004);
		var37 = var36 & 0x8000;
		if (var37 != 0)
		{
			while (1) {
				sceKernelDelayThread (0x64);
				var128 = *((int *) 0xBE200004);
				if ((var128 & 0x8000) != 0)
					continue;
				break;
			}
			var38 = *((int *) 0xBF90);
		}
		else
		{
			var38 = *((int *) 0xBF90);
		}
		if (var38 == 0)
		{
			sceKernelEnableIntr (0x0C);
			var119 = *((int *) 0xBF88);
			var120 = sp + 0x04;
			var123 = sceKernelWaitEventFlag (var119, 1, 0x11, var120, 0);
			sceKernelDisableIntr (0x0C);
			var39 = *((unsigned short *) 0xBFA4);
		}
		else
		{
			var39 = *((unsigned short *) 0xBFA4);
		}
		if ((var39 & 0x20) != 0)
		{
			var102 = *((int *) 0xBF98);
			if (var102 != 0)
			{
				var112 = ((int *) var102)[6];
				var115 var116 = (*var112) (var39, 0, 1, var29, var28);
			}
			*((int *) 0xBE20001C) = 0;
			var103 = *((int *) 0xBE20001C);
			if (!((var103 & 0x8000) != 0))
				goto label107;
			while (1) {
				sceKernelDelayThread (0x64);
				var111 = *((int *) 0xBE20001C);
				if ((var111 & 0x8000) != 0)
					continue;
				break;
			}
			var104 = *((int *) 0xBF90);
			goto label108;
		}
		else
		{
			var40 = *((int *) 0xBE200008);
			var41 = var40 & 0x8000;
			if (var41 != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var101 = *((int *) 0xBE200008);
					if ((var101 & 0x8000) != 0)
						continue;
					break;
				}
			}
			*((int *) 0xBE200008) = (var2 + 0xFFFFFFFF);
			var42 = *((int *) 0xBE200008);
			if ((var42 & 0x8000) != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var98 = *((int *) 0xBE200008);
					if ((var98 & 0x8000) != 0)
						continue;
					break;
				}
			}
			var43 = *((int *) 0xBE200004);
			var44 = var43 & 0x8000;
			if (var44 != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var95 = *((int *) 0xBE200004);
					if ((var95 & 0x8000) != 0)
						continue;
					break;
				}
			}
			*((int *) 0xBE200004) = 0x8A;
			var45 = *((int *) 0xBE200004);
			if ((var45 & 0x8000) != 0)
			{
				while (1) {
					sceKernelDelayThread (0x64);
					var92 = *((int *) 0xBE200004);
					if ((var92 & 0x8000) != 0)
						continue;
					break;
				}
				var46 = *((int *) 0xBF90);
			}
			else
			{
				var46 = *((int *) 0xBF90);
			}
			if (var46 == 0)
			{
				sceKernelEnableIntr (0x0C);
				var83 = *((int *) 0xBF88);
				var84 = sp + 0x08;
				var87 = sceKernelWaitEventFlag (var83, 1, 0x11, var84, 0);
				sceKernelDisableIntr (0x0C);
				var47 = *((unsigned short *) 0xBFA4);
			}
			else
			{
				var47 = *((unsigned short *) 0xBFA4);
			}
			if ((var47 & 0x20) != 0)
			{
				var66 = *((int *) 0xBF98);
				if (var66 != 0)
				{
					var76 = ((int *) var66)[6];
					var79 var80 = (*var76) (var47, 0, 2, var44, var43);
				}
				*((int *) 0xBE20001C) = 0;
				var67 = *((int *) 0xBE20001C);
				if ((var67 & 0x8000) != 0)
				{
					while (1) {
						sceKernelDelayThread (0x64);
						var75 = *((int *) 0xBE20001C);
						if ((var75 & 0x8000) != 0)
							continue;
						break;
					}
					var68 = *((int *) 0xBF90);
				}
				else
				{
					var68 = *((int *) 0xBF90);
				}
				if (var68 == 0)
				{
					var69 = *((int *) 0xBF8C);
					var72 = sceKernelUnlockMutex (var69, 1);
					if (var72 >= 0)
					{
						*((int *) 0xBF94) = 0;

					label169:
					}
					else
					{
					}
				}
				else
				{
					*((int *) 0xBF94) = 0;
					goto label169;
				}
			}
			else
			{
				var48 = 0;
				if (!(var2 <= 0))
				{
					while (1) {
						var49 = *((int *) 0xBE20000C);
						var48 = var48 + 1;
						((char *) (var6 + var48))[0] = var49;
						if (((var48 < var2)) != 0)
							continue;
						break;
					}
				}
				var50 = *((int *) 0xBF98);
				if (var50 != 0)
				{
					var60 = *((unsigned short *) 0xBFA4);
					var61 = ((int *) var50)[6];
					var64 var65 = (*var61) (var60, var6, var2, var44, var43);
				}
				*((int *) 0xBE20001C) = 0;
				var51 = *((int *) 0xBE20001C);
				if ((var51 & 0x8000) != 0)
				{
					while (1) {
						sceKernelDelayThread (0x64);
						var59 = *((int *) 0xBE20001C);
						if ((var59 & 0x8000) != 0)
							continue;
						break;
					}
					var52 = *((int *) 0xBF90);
				}
				else
				{
					var52 = *((int *) 0xBF90);
				}
				if (var52 == 0)
				{
					var53 = *((int *) 0xBF8C);
					var56 = sceKernelUnlockMutex (var53, 1);
					if (var56 >= 0)
					{
						*((int *) 0xBF94) = 0;

					label192:
					}
					else
					{
					}
				}
				else
				{
					*((int *) 0xBF94) = 0;
					goto label192;
				}
			}
		}
	}
}
void sub_04494 (){
	*((int *) 0xBF88) = 0;
	*((int *) 0xBF8C) = 0;
	*((int *) 0xBF90) = 0;
	*((int *) 0xBF94) = 0;
	*((int *) 0xBF98) = 0;
	*((int *) 0xBF9C) = 0;
	*((int *) 0xBFA0) = 0;
	*((int *) 0xBFA4) = 0;
	sceSysreg_driver_04839CA2 ();
	sceSysreg_driver_23944179 ();
	sceI2c_driver_EF4EF213 (0x09, 0x09);
	var9 = sceKernelCreateMutex (0xB8D0, 1, 0, 0);
	*((int *) 0xBF8C) = var9;
	var12 = sceKernelCreateEventFlag (0xB8D0, 1, 0, 0);
	*((int *) 0xBF88) = var12;
	sceKernelRegisterIntrHandler (0x0C, 2, 0x478C, 0, 0);
	sceKernelRegisterSysEventHandler (0xBE04);
}
void sub_04564 (){
	sceKernelUnregisterSysEventHandler (0xBE04);
	sceKernelReleaseIntrHandler (0x0C);
	sceKernelDeleteMutex (*((int *) 0xBF8C));
	sceKernelDeleteEventFlag (*((int *) 0xBF88));
}
void sceI2c_driver_5DDBAB44 (){
	*((int *) 0xBF88) = 0;
	*((int *) 0xBF8C) = 0;
	*((int *) 0xBF90) = 0;
	*((int *) 0xBF94) = 0;
	*((int *) 0xBF98) = 0;
	*((int *) 0xBF9C) = 0;
	*((int *) 0xBFA0) = 0;
	*((int *) 0xBFA4) = 0;
	sceSysreg_driver_04839CA2 ();
	sceSysreg_driver_23944179 ();
	sceI2c_driver_EF4EF213 (0x09, 0x09);
	*((int *) 0xBF8C) = sceKernelCreateMutex (0xB8D0, 1, 0, 0);
	*((int *) 0xBF88) = sceKernelCreateEventFlag (0xB8D0, 1, 0, 0);
	sceKernelRegisterIntrHandler (0x0C, 2, 0x478C, 0, 0);
	sceKernelRegisterSysEventHandler (0xBE04);
}
void sceI2c_driver_E79736C3 (){
	sceKernelUnregisterSysEventHandler (0xBE04);
	sceKernelReleaseIntrHandler (0x0C);
	sceKernelDeleteMutex (*((int *) 0xBF8C));
	sceKernelDeleteEventFlag (*((int *) 0xBF88));
}
void sceI2c_driver_8C5A4D15 (){
	sceSysreg_driver_6D204F2A ();
	sceSysreg_driver_917F9660 ();
}
void sceI2c_driver_E6360CA1 (){
	sceSysreg_driver_04839CA2 ();
	sceSysreg_driver_23944179 ();
	sceI2c_driver_EF4EF213 (*((int *) 0xBF9C), *((int *) 0xBFA0));
}
void sceI2c_driver_7B762CAF (int arg1){
	*((int *) 0xBF98) = arg1;
}
void sceI2c_driver_46AA2E3C (int arg1){
	*((int *) 0xBF90) = arg1;
}
void sceI2c_driver_0654A583 (){
	*((int *) 0xBE200020) = 1;
	sceKernelDelayThread (0x64);
	*((int *) 0xBE200020) = 0;
}
void sub_0478C (){
	*((int *) 0xBE200028) = 1;
	*((short *) 0xBFA4) = *((int *) 0xBE200000);
	sceKernelDisableIntr (0x0C);
	sceKernelSetEventFlag (*((int *) 0xBF88), 1);
}
void sub_047E4 (){
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = ra;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	*((int *) 0xBE20001C) = 1;
	var1 = *((int *) 0xBE20001C);
	if ((var1 & 0x8000) != 0)
	{
		while (1) {
			sceKernelDelayThread (0x64);
			var26 = *((int *) 0xBE20001C);
			if ((var26 & 0x8000) != 0)
				continue;
			break;
		}
	}
	*((int *) 0xBE20002C) = 1;
	var2 = *((int *) 0xBF9C);
	var3 = *((int *) 0xBE200010);
	if (var3 == var2)
	{

	label18:
		var6 = *((int *) 0xBFA0);
	}
	else
	{
		var4 = *((int *) 0xBE200010);
		if ((var4 & 0x8000) != 0)
		{
			while (1) {
				sceKernelDelayThread (0x64);
				var23 = *((int *) 0xBE200010);
				if ((var23 & 0x8000) != 0)
					continue;
				break;
			}
		}
		*((int *) 0xBE200010) = var2;
		var5 = *((int *) 0xBE200010);
		if (!((var5 & 0x8000) != 0))
			goto label18;
		while (1) {
			sceKernelDelayThread (0x64);
			var20 = *((int *) 0xBE200010);
			if ((var20 & 0x8000) != 0)
				continue;
			break;
		}
		var6 = *((int *) 0xBFA0);
	}
	var7 = *((int *) 0xBE200014);
	ra = ((int *) sp)[2];
	if (var7 == var6)
	{

	label30:
		var10 = ((int *) sp)[1];
	}
	else
	{
		var8 = *((int *) 0xBE200014);
		if ((var8 & 0x8000) != 0)
		{
			while (1) {
				sceKernelDelayThread (0x64);
				var17 = *((int *) 0xBE200014);
				if ((var17 & 0x8000) != 0)
					continue;
				break;
			}
		}
		*((int *) 0xBE200014) = var6;
		var9 = *((int *) 0xBE200014);
		ra = ((int *) sp)[2];
		if (!((var9 & 0x8000) != 0))
			goto label30;
		while (1) {
			sceKernelDelayThread (0x64);
			var14 = *((int *) 0xBE200014);
			ra = ((int *) sp)[2];
			if ((var14 & 0x8000) != 0)
				continue;
			break;
		}
		var10 = ((int *) sp)[1];
	}
	var11 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x4974
 */
void sceDmacplus_driver_78ED5F43 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var3 = sceDmacplus_driver_C751F860 ();
	ra = ((int *) sp)[0];
	if (!(var3 < 0))
	{
		var6 = sceDmacplus_driver_A79EE6F6 ();
		ra = ((int *) sp)[0];
		if (!(var6 < 0))
		{
			var9 = sceDmacplus_driver_8B6B73F9 ();
			ra = ((int *) sp)[0];
			if (!(var9 < 0))
			{
				var12 = sceDmacplus_driver_4ABEFBC1 ();
				ra = ((int *) sp)[0];
				if (!(var12 < 0))
				{
					var15 = sceDmacplus_driver_9C57AB36 ();
					ra = ((int *) sp)[0];
				}
			}
		}
	}
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x49D8
 */
void sceDmacplus_driver_61989D3A (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	((int *) sp)[3] = ra;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	if (!(var1 == 0))
	{
		if (!(((var1 < 0x0A)) == 0))
		{
			var2 = *((unsigned short *) 0xD70C);
			var3 = (var2 >> var1) & 1;
			if (var3 == 0)
			{
				var9 = sceKernelCpuSuspendIntr ();
				var10 = *((unsigned short *) 0xD70C);
				var11 = var10 | (1 << var1);
				*((short *) 0xD70C) = var11;
				sceKernelCpuResumeIntr (var9);
			}
			else
			{
			}
		}
	}
	ra = ((int *) sp)[3];
	var4 = ((int *) sp)[2];
	var5 = ((int *) sp)[1];
	var6 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x4A6C
 */
void sceDmacplus_driver_A258A023 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	((int *) sp)[3] = ra;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	if (!(var1 == 0))
	{
		if (!(((var1 < 0x0A)) == 0))
		{
			var2 = *((unsigned short *) 0xD70C);
			var3 = (var2 >> var1) & 1;
			if (var3 != 0)
			{
				var9 = sceKernelCpuSuspendIntr ();
				var10 = *((unsigned short *) 0xD70C);
				var11 = var10 & (!(1 << var1));
				*((short *) 0xD70C) = var11;
				sceKernelCpuResumeIntr (var9);
			}
			else
			{
			}
		}
	}
	ra = ((int *) sp)[3];
	var4 = ((int *) sp)[2];
	var5 = ((int *) sp)[1];
	var6 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x4B04
 */
int sceDmacplus_driver_6BB2E47C (int arg1)
{
	var1 = 0;
	if (arg1 == 0)
	{

	label6:
	}
	else
	{
		var1 = 0x80000102;
		if (((arg1 < 0x0A)) == 0)
			goto label6;
		var2 = (arg1 + (arg1 >> 0x1F)) >> 1;
		if ((arg1 & 1) != 0)
		{
			var4 = *((int *) 0xBC800018);
			var1 = (var4 >> var2) & 1;
			goto label6;
		}
		else
		{
			var3 = *((int *) 0xBC800014);
			var1 = (var3 >> var2) & 1;
		}
	}
	return var1;
}

/**
 * Subroutine at address 0x4B5C
 */
void sceDmacplus_driver_1068393E (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	((int *) sp)[1] = ra;
	if (!(arg1 == 0))
	{
		if (!(((arg1 < 0x0A)) == 0))
		{
			var4 = sceKernelCpuSuspendIntr ();
			var5 = (var1 + (var1 >> 0x1F)) >> 1;
			if ((var1 & 1) != 0)
			{
				var11 = *((int *) 0xBC80000C);
				var7 = (var11 >> var5) & 1;
				*((int *) 0xBC800010) = (var7 << var5);
			}
			else
			{
				var6 = *((int *) 0xBC800004);
				var7 = (var6 >> var5) & 1;
				*((int *) 0xBC800008) = (var7 << var5);
			}
			sceKernelCpuResumeIntrWithSync (var4);
		}
	}
	ra = ((int *) sp)[1];
	var10 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x4BFC
 */
void sub_04BFC (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[2] = s2;
	((int *) sp)[5] = ra;
	var1 = *((unsigned short *) 0xD70C);
	((int *) sp)[4] = s4;
	var2 = arg1;
	((int *) sp)[3] = s3;
	var3 = arg3;
	((int *) sp)[1] = s1;
	var4 = 0;
	((int *) sp)[0] = s0;
	var5 = 0;
	while (1) {
		var6 = 1 << var4;
		if (!(var5 == 0))
		{
			var7 = *((int *) 0xBC800004);
			if (!((var7 & var6) == 0))
			{
				*((int *) 0xBC800008) = var6;
				if ((var1 & (1 << var5)) != 0)
				{
					InterruptManagerForKernel_8BE96A2E (var2, var5, var5, var3);
				}
			}
		}
		var8 = *((int *) 0xBC80000C);
		var9 = var5 + 1;
		var10 = 1 << var4;
		var5 = var5 + 2;
		var4 = var4 + 1;
		if ((var8 & var10) == 0)
		{

		label14:
			var11 = (var5 < 0x0A);
		}
		else
		{
			*((int *) 0xBC800010) = var10;
			if (!((var1 & (1 << var9)) != 0))
				goto label14;
			InterruptManagerForKernel_8BE96A2E (var2, var9, var9, var3);
			var11 = (var5 < 0x0A);
		}
		if (!(var11 != 0))
			break;
		continue;
	}
	ra = ((int *) sp)[5];
	var12 = ((int *) sp)[4];
	var13 = ((int *) sp)[3];
	var14 = ((int *) sp)[2];
	var15 = ((int *) sp)[1];
	var16 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}
void sub_04D04 (){
	sceSysreg_driver_3A14B278 ();
	*((short *) 0xD70C) = 0;
	sceKernelRegisterIntrHandler (0x15, 2, 0x4BFC, 0, 0xBAAC);
	sceKernelEnableIntr (0x15);
	sceDmacplus_driver_8472BB23 ();
	sceDmacplus_driver_6292E01D ();
	sceDmacplus_driver_84EBD5B1 ();
	sceDmacplus_driver_54A776A3 ();
	sceDmacplus_driver_4DB8CA36 ();
	sceKernelRegisterSysEventHandler (0xBE44);
}
void sub_04D88 (){
	sceKernelUnregisterSysEventHandler (0xBE44);
	sceDmacplus_driver_5FEC19EE ();
	sceDmacplus_driver_3A5F9CC1 ();
	sceDmacplus_driver_4391D45C ();
	sceDmacplus_driver_983FABB2 ();
	sceDmacplus_driver_BB77E17A ();
	sceKernelReleaseIntrHandler (0x15);
}
void sceDmacplus_driver_BF888BEC (){
	sceSysreg_driver_3A14B278 ();
	*((short *) 0xD70C) = 0;
	sceKernelRegisterIntrHandler (0x15, 2, 0x4BFC, 0, 0xBAAC);
	sceKernelEnableIntr (0x15);
	sceDmacplus_driver_8472BB23 ();
	sceDmacplus_driver_6292E01D ();
	sceDmacplus_driver_84EBD5B1 ();
	sceDmacplus_driver_54A776A3 ();
	sceDmacplus_driver_4DB8CA36 ();
	sceKernelRegisterSysEventHandler (0xBE44);
}
void sceDmacplus_driver_3B3C6252 (){
	sceKernelUnregisterSysEventHandler (0xBE44);
	sceDmacplus_driver_5FEC19EE ();
	sceDmacplus_driver_3A5F9CC1 ();
	sceDmacplus_driver_4391D45C ();
	sceDmacplus_driver_983FABB2 ();
	sceDmacplus_driver_BB77E17A ();
	sceKernelReleaseIntrHandler (0x15);
}
void sceDmacplus_driver_E7580E49 (){
	sceDmacplus_driver_B94CB1D4 ();
	sceDmacplus_driver_0F01FE4A ();
	sceDmacplus_driver_539A58C9 ();
	sceDmacplus_driver_F5F2AD5E ();
	sceDmacplus_driver_A05CA13D ();
	sceSysreg_driver_B595FC22 ();
}
void sceDmacplus_driver_3E868CEE (){
	sceSysreg_driver_3A14B278 ();
	sceDmacplus_driver_0B1C48AA ();
	sceDmacplus_driver_7D7BE745 ();
	sceDmacplus_driver_975BB7E2 ();
	sceDmacplus_driver_A836FBEA ();
	sceDmacplus_driver_7A9001AF ();
}

/**
 * Subroutine at address 0x4F44
 */
void sub_04F44 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	if (arg1 == 0x4004)
	{
		sceDmacplus_driver_B94CB1D4 ();
		sceDmacplus_driver_0F01FE4A ();
		sceDmacplus_driver_539A58C9 ();
		sceDmacplus_driver_F5F2AD5E ();
		sceDmacplus_driver_A05CA13D ();
		sceSysreg_driver_B595FC22 ();

	label37:
		ra = ((int *) sp)[0];
	}
	else
	{
		if (((arg1 < 0x4005)) == 0)
		{
			if (arg1 != 0x00010004)
			{
			}
			else
			{
				sceSysreg_driver_3A14B278 ();
				sceDmacplus_driver_0B1C48AA ();
				sceDmacplus_driver_7D7BE745 ();
				sceDmacplus_driver_975BB7E2 ();
				sceDmacplus_driver_A836FBEA ();
				sceDmacplus_driver_7A9001AF ();
			}
			goto label37;
		}
		else
		{
			if (arg1 == 0x0402)
			{
				sceDmacplus_driver_78ED5F43 ();
				ra = ((int *) sp)[0];
			}
			else
			{
				goto label37;
			}
		}
	}
	sp = sp + 0x10;
	return;
}
void sub_05008 (int arg1, int arg2){
	*((short *) 0xD70C) = (*((unsigned short *) 0xD70C) | (1 << arg2));
}
void sub_05028 (int arg1, int arg2){
	*((short *) 0xD70C) = (*((unsigned short *) 0xD70C) & (!(1 << arg2)));
}

/**
 * Subroutine at address 0x504C
 */
void sceDmacplus_driver_8472BB23 (){
	memset (0xBFC0, 0, 0x1000);
	var5 = sceKernelCpuSuspendIntr ();
	var6 = *((int *) 0xBC800110);
	var7 = *((unsigned short *) 0xD70E);
	var8 = (var7 & 0xFFFFFFFE) | (0 & 1);
	var9 = 0;
	*((int *) 0xBFA8) = 0;
	*((int *) 0xBFAC) = 0xFFFFFFFF;
	*((short *) 0xD70E) = var8;
	if (!((var6 & 1) == 0))
	{
		var10 = *((int *) 0xBC80010C);
		*((short *) 0xD70E) = (var8 | 1);
		var11 = *((int *) 0xBC800108);
		var12 = *((int *) 0xBC800104);
		*((int *) 0xBFB8) = var10;
		*((int *) 0xBFBC) = var12;
		*((int *) 0xBFB4) = var11;
		if (!(var10 == 0))
		{
			var9 = *((int *) 0xBC800100);
		}
	}
	sceDmacplus_driver_BA1605D2 (var9);
	InterruptManagerForKernel_CFFA1857 (0x15, 1, 0x56A8, 0);
	sceKernelEnableSubIntr (0x15, 1);
	*((int *) 0xBC800110) |= 2;
	sceKernelCpuResumeIntrWithSync (var5);
	sceDmacplus_driver_CBE11C48 ();
	ra = ((int *) sp)[1];
	var24 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x5150
 */
void sceDmacplus_driver_0B1C48AA ()
{
	var1 = *((int *) 0xBFB8);
	var4 = *((int *) 0xBFB0);
	*((int *) 0xBC800110) = 2;
	*((int *) 0xBC800108) = *((int *) 0xBFB4);
	*((int *) 0xBC80010C) = var1;
	*((int *) 0xBC800104) = *((int *) 0xBFBC);
	if (var4){
		*((int *) 0xBC800100) = ((var4 >> 0) & 0x1FFFFFFF);
		*((int *) 0xBC80010C) = var1;
		var5 = *((int *) 0xBFA8);
	}else{
		*((int *) 0xBC800100) = ((0xBFC0 >> 0) & 0x1FFFFFFF);
		*((int *) 0xBC80010C) = 0;
		var5 = *((int *) 0xBFA8);
	}
	if (!var5)
		if (*((unsigned short *) 0xD70E) & 1)
			*((int *) 0xBC800110) |= 1;
	return;
}

/**
 * Subroutine at address 0x5204
 */
void sceDmacplus_driver_BA1605D2 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	((int *) sp)[1] = ra;
	if (arg1 == 0)
	{

	label12:
		var7 = sceKernelCpuSuspendIntr ();
		if (var1 == 0)
		{
			var18 = *((int *) 0xBFAC);
			if (var18 == 1)
			{
				var11 = *((int *) 0xBFA8);
			}
			else
			{
				var17 = *((int *) 0xBC800110);
				*((int *) 0xBFAC) = 1;
				*((int *) 0xBC800110) = ((var17 & 0xFFFFFFFE) | (0 & 1));
				*((int *) 0xBC800100) = ((0xBFC0 >> 0) & 0x1FFFFFFF);

			label23:
				*((int *) 0xBC80010C) = 0;
				*((int *) 0xBC800110) = var17;
				var11 = *((int *) 0xBFA8);
			}
		}
		else
		{
			if (((var1 >> 14) & 0x7FFF) == 0x04)
			{
				if (((0x35 >> ((var1 >> 29) & 0x07)) & 1) == 0)
				{

				label25:
					var8 = *((int *) 0xBFAC);
					if (var8 == 0)
					{
						*((int *) 0xBC800100) = ((var1 >> 0) & 0x1FFFFFFF);
						var11 = *((int *) 0xBFA8);
					}
					else
					{
						var9 = *((int *) 0xBC800110);
						var10 = *((int *) 0xBFB8);
						*((int *) 0xBC800110) = ((var9 & 0xFFFFFFFE) | (0 & 1));
						*((int *) 0xBC800100) = ((var1 >> 0) & 0x1FFFFFFF);
						*((int *) 0xBC80010C) = var10;
						*((int *) 0xBC800110) = var9;
						*((int *) 0xBFAC) = 0;
						var11 = *((int *) 0xBFA8);
					}
				}
				else
				{
					var16 = *((int *) 0xBFAC);
					if (var16 == 2)
					{
						var11 = *((int *) 0xBFA8);
					}
					else
					{
						var17 = *((int *) 0xBC800110);
						*((int *) 0xBFAC) = 2;
						*((int *) 0xBC800110) = ((var17 & 0xFFFFFFFE) | (0 & 1));
						*((int *) 0xBC800100) = ((var1 >> 0) & 0x1FFFFFFF);
						goto label23;
					}
				}
			}
			else
			{
				goto label25;
			}
		}
		*((int *) 0xBFB0) = var1;
		if (!(var11 == 0))
		{
			var12 = *((unsigned short *) 0xD70E);
			if (!((var12 & 1) == 0))
			{
				var13 = *((int *) 0xBC800110);
				*((int *) 0xBC800110) = (var13 | 1);
			}
		}
		sceKernelCpuResumeIntrWithSync (var7);
		var2 = 0;
	}
	else
	{
		var2 = 0x80000103;
		if (!((arg1 & 0x0F) != 0))
		{
			if (((var1 >> 23) & 0x3F) == 0x08)
			{
				var3 = (var1 >> 27) & 0x1F;
				if (((0x35 >> ((var1 >> 29) & 0x07)) & 1) != 0)
					goto label12;

			label8:
				if (((0x00220202 >> var3) & 1) != 0)
					goto label12;
				if (((var1 >> 14) & 0x7FFF) == 0x04)
				{
					if (!(((0x35 >> ((var1 >> 29) & 0x07)) & 1) == 0))
						goto label12;

				label36:
					var2 = 0x80000103;
				}
				else
				{
					goto label36;
				}
			}
			else
			{
				var3 = (var1 >> 27) & 0x1F;
				goto label8;
			}
		}
	}
	ra = ((int *) sp)[1];
	var4 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x5428
 */
void sceDmacplus_driver_FFF6EE05 (int arg1, int arg2, int arg3)
{
	var1 = 0x80000104;
	if (!((arg1 & 0x07) != 0))
	{
		if (!((arg2 & 0x3F) != 0))
		{
			var1 = 0x80000108;
			if (!(((arg3 < 0x04)) == 0))
			{
				var2 = *((int *) 0xBFA8);
				var1 = 0x80000021;
				if (var2 != 0)
				{

				label7:
					*((int *) 0xBFBC) = arg3;
					var1 = 0;
					*((int *) 0xBFB4) = arg1;
					*((int *) 0xBFB8) = arg2;
					*((int *) 0xBC800108) = arg1;
					*((int *) 0xBC80010C) = arg2;
					*((int *) 0xBC800104) = arg3;
				}
				else
				{
					var3 = *((unsigned short *) 0xD70E);
					if (!((var3 & 1) != 0))
						goto label7;
				}
			}
		}
	}
	return;
}
void sceDmacplus_driver_464AB3C1 (int arg1, int arg2, int arg3){
	if (arg1)*arg1=*((int *) 0xBFB4);
	if (arg2)*arg2=*((int *) 0xBFB8);
	if (arg3)*arg3=*((int *) 0xBFBC);
}

/**
 * Subroutine at address 0x54E4
 */
void sceDmacplus_driver_CBE11C48 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	((int *) sp)[1] = ra;
	var3 = sceKernelCpuSuspendIntr ();
	var4 = *((unsigned short *) 0xD70E);
	var5 = var4 & 1;
	if (var5 == 0)
	{

	label6:
		*((short *) 0xD70E) = (var4 | 1);
		var7 = *((int *) 0xBFB0);
		var8 = (0xBFC0 >> 0) & 0x1FFFFFFF;
		*((int *) 0xBFA8) = 0;
		if (var7 == 0)
		{

		label9:
			*((int *) 0xBC800100) = var8;
			*((int *) 0xBC80010C) = 0;
		}
		else
		{
			if (((var7 >> 14) & 0x7FFF) == 0x04)
			{
				var8 = (var7 >> 0) & 0x1FFFFFFF;
				if (!(((0x35 >> ((var7 >> 29) & 0x07)) & 1) == 0))
					goto label9;

			label10:
				var9 = *((int *) 0xBFB0);
				var10 = *((int *) 0xBFB8);
				*((int *) 0xBC800100) = ((var9 >> 0) & 0x1FFFFFFF);
				*((int *) 0xBC80010C) = var10;
			}
			else
			goto label10;
		}
		var11 = *((int *) 0xBC800110);
		*((int *) 0xBC800110) = (var11 | 1);
	}
	else
	{
		var6 = *((int *) 0xBFA8);
		if (!(var6 == 0))
			goto label6;
	}
	sceKernelCpuResumeIntrWithSync (var3);
	ra = ((int *) sp)[1];
	var14 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}
void sceDmacplus_driver_BB77E17A (){
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xBC800110) &= 0xFFFFFFFD;
	sceKernelReleaseSubIntrHandler (0x15, 1);
	sceKernelCpuResumeIntr (intr);
}
int sceDmacplus_driver_C751F860 (){
	return 0;
}
void sceDmacplus_driver_B94CB1D4 (){
	*((int *) 0xBC800110) = 0;
}
void sceDmacplus_driver_8438DB83 (){
	return *((int *) 0xBFB0);
}
void sceDmacplus_driver_7321EDEE (){
	intr = sceKernelCpuSuspendIntr ();
	var4 = *((unsigned short *) 0xD70E);
	if (var4 & 1){
		*((short *) 0xD70E) = (var4 - var4 & 1);
		*((int *) 0xBC800110) = ((*((int *) 0xBC800110) & 0xFFFFFFFE) | (0 & 1));
	}
	sceKernelCpuResumeIntrWithSync (intr);
}
void sub_056A8 (){
	*((int *) 0xBC800110) = ((*((int *) 0xBC800110) & 0xFFFFFFFE) | (0 & 1));
	*((int *) 0xBFB0) = 0;
	*((int *) 0xBFA8) = 1;
}

/**
 * Subroutine at address 0x56D8
 */
void sceDmacplus_driver_6BB9BD45 (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFC0;
	((int *) sp)[12] = fp;
	var1 = arg2;
	((int *) sp)[11] = s7;
	var2 = arg1;
	((int *) sp)[10] = s6;
	var3 = arg3;
	((int *) sp)[13] = ra;
	((int *) sp)[9] = s5;
	((int *) sp)[8] = s4;
	((int *) sp)[7] = s3;
	((int *) sp)[6] = s2;
	((int *) sp)[5] = s1;
	((int *) sp)[4] = s0;
	if (!(arg1 == 0))
	{
		var6 = sceKernelCpuSuspendIntr ();
		var7 = *((unsigned short *) 0xD70E);
		var8 = var7 & 0x0A;
		((int *) sp)[0] = var6;
		if (var8 != 0)
		{
			var41 = ((int *) sp)[0];
			sceKernelCpuResumeIntr (var41, var8);
		}
		else
		{
			var9 = *((int *) 0xD008);
			var10 = var7 | 2;
			*((short *) 0xD70E) = var10;
			if (!(var9 == 0))
			{
				*((short *) 0xD70E) = (var10 | 0xFFFF8000);
			}
			var11 = ((int *) var3)[4];
			var12 = ((int *) var3)[5];
			var13 = ((int *) var3)[6];
			var14 = ((int *) var3)[7];
			var15 = ((int *) var3)[8];
			var16 = ((int *) var3)[9];
			var17 = ((int *) var3)[10];
			var18 = ((int *) var3)[11];
			*((int *) 0xBC800120) = (((((var11 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var11 & 0x1FFFFFFF));
			*((int *) 0xBC800124) = (((((var12 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var12 & 0x1FFFFFFF));
			*((int *) 0xBC800128) = (((((var13 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var13 & 0x1FFFFFFF));
			*((int *) 0xBC80012C) = (((((var14 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var14 & 0x1FFFFFFF));
			*((int *) 0xBC800130) = (((((var15 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var15 & 0x1FFFFFFF));
			*((int *) 0xBC800134) = (((((var16 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var16 & 0x1FFFFFFF));
			*((int *) 0xBC800138) = (((((var17 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var17 & 0x1FFFFFFF));
			*((int *) 0xBC80013C) = (((((var18 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var18 & 0x1FFFFFFF));
			*((int *) 0xBC800144) = (((((var2 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var2 & 0x1FFFFFFF));
			*((int *) 0xBC800148) = (((((var1 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var1 & 0x1FFFFFFF));
			if (var1 == 0)
			{
				var40 = *((int *) 0xD004);
				var20 = (var40 << 0x08) | (var9 << 1);
			}
			else
			{
				var19 = *((int *) 0xD004);
				var20 = ((var19 << 0x08) | (var9 << 1)) | 1;
			}
			*((int *) 0xBC80014C) = var20;
			var21 = ((int *) var3)[0];
			var22 = ((int *) var3)[1];
			var23 = ((int *) var3)[2];
			var24 = ((int *) var3)[3];
			var25 = *((int *) 0xCFC0);
			*((int *) 0xBC800140) = (((((var21 & 0x3F) << 0x10) | ((var22 & 0x3F) << 0x08)) | ((var23 & 1) << 2)) | ((var24 & 1) << 1));
			*((int *) 0xBC800160) = 0x0D;
			sceKernelClearEventFlag (var25, 0xFFFFFFFC);
			var28 = ((int *) sp)[0];
			sceKernelCpuResumeIntrWithSync (var28);
		}
	}
	ra = ((int *) sp)[13];
	var31 = ((int *) sp)[12];
	var32 = ((int *) sp)[11];
	var33 = ((int *) sp)[10];
	var34 = ((int *) sp)[9];
	var35 = ((int *) sp)[8];
	var36 = ((int *) sp)[7];
	var37 = ((int *) sp)[6];
	var38 = ((int *) sp)[5];
	var39 = ((int *) sp)[4];
	sp = sp + 0x40;
	return;
}

/**
 * Subroutine at address 0x597C
 */
void sceDmacplus_driver_86EAC84A (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[4] = s4;
	var1 = arg2;
	((int *) sp)[3] = s3;
	var2 = arg1;
	((int *) sp)[2] = s2;
	var3 = arg3;
	((int *) sp)[6] = ra;
	((int *) sp)[5] = s5;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	if (!(arg1 == 0))
	{
		var6 = sceKernelCpuSuspendIntr ();
		var7 = ((int *) var3)[1];
		var8 = *((unsigned short *) 0xD70E);
		var9 = var6;
		var10 = var7 & 0x07;
		if (((var8 & 0xFFFF) & (!(var10) ? 0x0A : 0x1A)) != 0)
		{
			sceKernelCpuResumeIntr (var9, 0x0A, var10);
		}
		else
		{
			var11 = ((int *) var3)[4];
			var12 = ((int *) var3)[5];
			var13 = ((int *) var3)[6];
			var14 = ((int *) var3)[7];
			var15 = ((int *) var3)[8];
			var16 = ((int *) var3)[9];
			*((int *) 0xBC800120) = (((((var11 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var11 & 0x1FFFFFFF));
			*((short *) 0xD70E) = (var8 | 0xFFFF8002);
			*((int *) 0xBC800128) = (((((var12 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var12 & 0x1FFFFFFF));
			*((int *) 0xBC800130) = (((((var13 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var13 & 0x1FFFFFFF));
			*((int *) 0xBC800134) = (((((var14 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var14 & 0x1FFFFFFF));
			*((int *) 0xBC800138) = (((((var15 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var15 & 0x1FFFFFFF));
			*((int *) 0xBC80013C) = (((((var16 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var16 & 0x1FFFFFFF));
			*((int *) 0xBC800144) = (((((var2 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var2 & 0x1FFFFFFF));
			*((int *) 0xBC800148) = (((((var1 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var1 & 0x1FFFFFFF));
			if (var1 == 0)
			{
				var35 = *((int *) 0xD008);
				var36 = *((int *) 0xD004);
				var19 = (var36 << 0x08) | (var35 << 1);
			}
			else
			{
				var17 = *((int *) 0xD008);
				var18 = *((int *) 0xD004);
				var19 = ((var18 << 0x08) | (var17 << 1)) | 1;
			}
			*((int *) 0xBC80014C) = var19;
			var20 = ((int *) var3)[0];
			var21 = ((int *) var3)[1];
			var22 = ((int *) var3)[2];
			var23 = ((int *) var3)[3];
			var24 = *((int *) 0xCFC0);
			*((int *) 0xBC800140) = ((((((var20 & 0x3F) << 0x10) | ((var21 & 0x3F) << 0x08)) | ((var22 & 1) << 2)) | ((var23 & 1) << 1)) | 1);
			*((int *) 0xBC800160) = 0x0D;
			sceKernelClearEventFlag (var24, 0xFFFFFFFC);
			sceKernelCpuResumeIntrWithSync (var9);
		}
	}
	ra = ((int *) sp)[6];
	var29 = ((int *) sp)[5];
	var30 = ((int *) sp)[4];
	var31 = ((int *) sp)[3];
	var32 = ((int *) sp)[2];
	var33 = ((int *) sp)[1];
	var34 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x5BDC
 */
void sceDmacplus_driver_0A40EF79 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[4] = s0;
	var1 = arg2;
	((int *) sp)[6] = ra;
	((int *) sp)[5] = s1;
	if (arg1 == 0)
	{
		var25 = *((int *) 0xCFC0);
		var26 = sp;
		var29 = sceKernelWaitEventFlag (var25, 0x03, 1, var26, 0);
		var8 = var29;

	label10:
		var2 = var8;
		if (var8 < 0)
		{

		label15:
			ra = ((int *) sp)[6];
		}
		else
		{
			var9 = ((int *) sp)[0];
			ra = ((int *) sp)[6];
			if (!((var9 & 2) == 0))
			{
				if (!(var1 == 0))
				{
					var10 = *((int *) 0xCFC4);
					((int *) var1)[0] = var10;
					var11 = *((int *) 0xCFC8);
					((int *) var1)[1] = var11;
					var12 = *((int *) 0xCFCC);
					((int *) var1)[2] = var12;
					var13 = *((int *) 0xCFD0);
					((int *) var1)[3] = var13;
					var14 = *((int *) 0xCFD4);
					((int *) var1)[4] = var14;
					var15 = *((int *) 0xCFD8);
					((int *) var1)[5] = var15;
					var16 = *((int *) 0xCFDC);
					((int *) var1)[6] = var16;
					var17 = *((int *) 0xCFE0);
					((int *) var1)[7] = var17;
					var18 = *((int *) 0xCFE4);
					((int *) var1)[8] = var18;
					var19 = *((int *) 0xCFE8);
					((int *) var1)[9] = var19;
					var20 = *((int *) 0xCFEC);
					((int *) var1)[10] = var20;
					var21 = *((int *) 0xCFF0);
					((int *) var1)[11] = var21;
				}
				var22 = *((unsigned short *) 0xD70E);
				*((short *) 0xD70E) = (var22 & 0x7FFD);
				var2 = 0xFFFFFFFF;
				goto label15;
			}
		}
	}
	else
	{
		var2 = 0x80000107;
		if (arg1 != 1)
			goto label15;
		var3 = *((int *) 0xCFC0);
		var4 = sp;
		var7 = sceKernelPollEventFlag (var3, 0x03, 1, var4);
		var8 = var7;
		var2 = 1;
		if (var7 == 0x800201AF)
			goto label15;
		goto label10;
	}
	var23 = ((int *) sp)[5];
	var24 = ((int *) sp)[4];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x5D08
 */
void sceDmacplus_driver_6292E01D ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	((int *) sp)[3] = ra;
	((int *) sp)[2] = s2;
	var3 = sceKernelCpuSuspendIntr ();
	memset (0xCFC0, 0, 0x4C);
	var6 = *((int *) 0xBC800150);
	*((int *) 0xCFF4) = var6;
	var7 = *((int *) 0xBC800154);
	*((int *) 0xCFF8) = var7;
	var8 = *((int *) 0xBC800158);
	*((int *) 0xCFFC) = var8;
	var9 = *((int *) 0xBC80015C);
	*((int *) 0xD000) = var9;
	var12 = sceKernelCreateEventFlag ("SceDmacplusAvc", 0x0201, 1, 0);
	*((int *) 0xCFC0) = var12;
	InterruptManagerForKernel_CFFA1857 (0x15, 0x03, 0x602C, 0);
	InterruptManagerForKernel_CFFA1857 (0x15, 2, 0x612C, 0);
	sceKernelEnableSubIntr (0x15, 0x03);
	sceKernelEnableSubIntr (0x15, 2);
	*((int *) 0xBC800160) = 0;
	sceKernelCpuResumeIntrWithSync (var3);
	ra = ((int *) sp)[3];
	var23 = ((int *) sp)[2];
	var24 = ((int *) sp)[1];
	var25 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}
void sceDmacplus_driver_983FABB2 (){
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xBC800160) = 0;
	sceKernelReleaseSubIntrHandler (0x15, 0x03);
	sceKernelReleaseSubIntrHandler (0x15, 2);
	sceKernelDeleteEventFlag (*((int *) 0xCFC0));
	sceKernelCpuResumeIntr (intr);
}
int sceDmacplus_driver_A79EE6F6 (){
	return (*((unsigned short *) 0xD70E)&2) ? -1 : 0;
}
void sceDmacplus_driver_0F01FE4A (){
	*((int *) 0xBC800160) = 0;
}
void sceDmacplus_driver_7D7BE745 (){
	*((int *) 0xBC800150) = *((int *) 0xCFF4);
	*((int *) 0xBC800154) = *((int *) 0xCFF8);
	*((int *) 0xBC800158) = *((int *) 0xCFFC);
	*((int *) 0xBC80015C) = *((int *) 0xD000);
}
void sceDmacplus_driver_960D7B8A (int arg1, int arg2, int arg3){
	var4 = sceKernelCpuSuspendIntr ();
	if (*((unsigned short *) 0xD70E) & 2){
		sceKernelCpuResumeIntr (var4, var6, 0x00010000);
		return;
	}
	var7 = ((unsigned short *) arg3)[2];
	var8 = ((unsigned short *) arg3)[1];
	var9 = ((unsigned short *) arg3)[5];
	var10 = ((unsigned short *) arg3)[4];
	var11 = ((unsigned short *) arg3)[8];
	var12 = ((unsigned short *) arg3)[7];
	var13 = ((unsigned short *) arg3)[10];
	var14 = ((unsigned short *) arg3)[6];
	var15 = ((unsigned short *) arg3)[0];
	var16 = ((unsigned short *) arg3)[3];
	var17 = var12 & 0x03FF;
	var18 = ((unsigned char *) arg3)[18];
	var19 = (var7 & 0x03FF) << 0x14;
	var20 = (var19 | ((var8 & 0x03FF) << 0x0A)) | (var15 & 0x03FF);
	var21 = (((var9 & 0x03FF) << 0x14) | ((var10 & 0x03FF) << 0x0A)) | (var16 & 0x03FF);
	var22 = (((var11 & 0x03FF) << 0x14) | (var17 << 0x0A)) | (var14 & 0x03FF);
	var23 = ((var13 & 1) << 0x08) | var18;
	*((int *) 0xD008) = arg1;
	*((int *) 0xBC800150) = var20;
	*((int *) 0xD004) = arg2;
	*((int *) 0xBC800154) = var21;
	*((int *) 0xBC800158) = var22;
	*((int *) 0xBC80015C) = var23;
	*((int *) 0xCFF4) = var20;
	*((int *) 0xCFF8) = var21;
	*((int *) 0xCFFC) = var22;
	*((int *) 0xD000) = var23;
	sceKernelCpuResumeIntr (var4, var19, var17);
}

/**
 * Subroutine at address 0x602C
 */
void sub_0602C ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var1 = *((int *) 0xBC800160);
	*((int *) 0xBC800160) = ((var1 & 0xFFFFFFFE) | (0 & 1));
	var2 = *((int *) 0xBC800120);
	*((int *) 0xCFC4) = var2;
	var3 = *((int *) 0xBC800124);
	*((int *) 0xCFC8) = var3;
	var4 = *((int *) 0xBC800128);
	*((int *) 0xCFCC) = var4;
	var5 = *((int *) 0xBC80012C);
	*((int *) 0xCFD0) = var5;
	var6 = *((int *) 0xBC800130);
	*((int *) 0xCFD4) = var6;
	var7 = *((int *) 0xBC800134);
	var8 = *((int *) 0xCFC0);
	*((int *) 0xCFD8) = var7;
	var9 = *((int *) 0xBC800138);
	*((int *) 0xCFDC) = var9;
	var10 = *((int *) 0xBC80013C);
	*((int *) 0xCFE0) = var10;
	var11 = *((int *) 0xBC800140);
	*((int *) 0xCFE4) = var11;
	var12 = *((int *) 0xBC800144);
	*((int *) 0xCFE8) = var12;
	var13 = *((int *) 0xBC800148);
	*((int *) 0xCFEC) = var13;
	var14 = *((int *) 0xBC80014C);
	*((int *) 0xCFF0) = var14;
	sceKernelSetEventFlag (var8, 2);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}
void sub_0612C (){
	sceKernelSetEventFlag (*((int *) 0xCFC0), 1);
	*((short *) 0xD70E) &= 0x7FFD);
}

/**
 * Subroutine at address 0x6168
 */
void sceDmacplus_driver_FBE5DE3E (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[0] = s0;
	((int *) sp)[2] = s2;
	var1 = 0x80000104;
	((int *) sp)[1] = s1;
	((int *) sp)[4] = ra;
	((int *) sp)[3] = s3;
	if (!(((arg3 < 0x1000)) == 0))
	{
		var4 = sceKernelCpuSuspendIntr ();
		var5 = *((unsigned short *) 0xD70E);
		var6 = arg3 | 0x82909000;
		if ((var5 & 0x0C) != 0)
		{
			sceKernelCpuResumeIntr (var4, 0xFFFFFFFC, var6);
			var1 = 0x80000021;
		}
		else
		{
			var7 = *((int *) 0xD00C);
			*((short *) 0xD70E) = (var5 | 0x04);
			*((int *) 0xBC800180) = ((arg2 >> 0) & 0x1FFFFFFF);
			*((int *) 0xBC800184) = ((arg1 >> 0) & 0x1FFFFFFF);
			*((int *) 0xBC800188) = 0;
			*((int *) 0xBC80018C) = var6;
			*((int *) 0xBC800190) = 0xC001;
			sceKernelClearEventFlag (var7, 0xFFFFFFFC);
			sceKernelCpuResumeIntrWithSync (var4);
			var1 = 0;
		}
	}
	ra = ((int *) sp)[4];
	var12 = ((int *) sp)[3];
	var13 = ((int *) sp)[2];
	var14 = ((int *) sp)[1];
	var15 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x6258
 */
void sceDmacplus_driver_8AA7F020 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	((int *) sp)[2] = ra;
	var1 = arg1;
	var4 = sceKernelCpuSuspendIntr ();
	var5 = var4;
	var6 = *((unsigned short *) 0xD70E);
	var7 = var6 | 0x04;
	if ((var6 & 0x0C) != 0)
	{
		sceKernelCpuResumeIntr (var5, var6, var7);
	}
	else
	{
		var8 = ((int *) var1)[0];
		*((short *) 0xD70E) = var7;
		*((int *) 0xBC800180) = var8;
		var9 = ((int *) var1)[1];
		*((int *) 0xBC800184) = var9;
		var10 = ((int *) var1)[2];
		*((int *) 0xBC800188) = var10;
		var11 = ((int *) var1)[3];
		if ((var11 & 0x08000000) != 0)
		{
			*((int *) 0xBC80018C) = (var11 | 0x0A909000);
		}
		else
		{
			*((int *) 0xBC80018C) = (var11 | 0x02489000);
		}
		var12 = *((int *) 0xD00C);
		*((int *) 0xBC800190) = 0xC001;
		sceKernelClearEventFlag (var12, 0xFFFFFFFC);
		sceKernelCpuResumeIntrWithSync (var5);
	}
	ra = ((int *) sp)[2];
	var17 = ((int *) sp)[1];
	var18 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x6348
 */
void sceDmacplus_driver_915A917C (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[4] = s0;
	var1 = arg2;
	((int *) sp)[6] = ra;
	((int *) sp)[5] = s1;
	if (arg1 == 0)
	{
		var17 = *((int *) 0xD00C);
		var18 = sp;
		var21 = sceKernelWaitEventFlag (var17, 0x03, 1, var18, 0);
		var8 = var21;

	label10:
		var2 = var8;
		if (var8 < 0)
		{

		label15:
			ra = ((int *) sp)[6];
		}
		else
		{
			var9 = ((int *) sp)[0];
			ra = ((int *) sp)[6];
			if (!((var9 & 2) == 0))
			{
				if (!(var1 == 0))
				{
					var10 = *((int *) 0xD010);
					((int *) var1)[0] = var10;
					var11 = *((int *) 0xD014);
					((int *) var1)[1] = var11;
					var12 = *((int *) 0xD018);
					((int *) var1)[2] = var12;
					var13 = *((int *) 0xD01C);
					((int *) var1)[3] = var13;
				}
				var14 = *((unsigned short *) 0xD70E);
				*((short *) 0xD70E) = ((var14 & 0xFFFFFFFB) | (0 & 1));
				var2 = 0xFFFFFFFF;
				goto label15;
			}
		}
	}
	else
	{
		var2 = 0x80000107;
		if (arg1 != 1)
			goto label15;
		var3 = *((int *) 0xD00C);
		var4 = sp;
		var7 = sceKernelPollEventFlag (var3, 0x03, 1, var4);
		var8 = var7;
		var2 = 1;
		if (var7 == 0x800201AF)
			goto label15;
		goto label10;
	}
	var15 = ((int *) sp)[5];
	var16 = ((int *) sp)[4];
	sp = sp + 0x20;
	return;
}
void sceDmacplus_driver_84EBD5B1 (){
	intr = sceKernelCpuSuspendIntr ();
	*((short *) 0xD70E) &= 0xFFFFFFFB;
	*((int *) 0xD00C) = sceKernelCreateEventFlag ("SceDmacplusSc2Me", 0x0201, 1, 0);
	InterruptManagerForKernel_CFFA1857 (0x15, 0x05, 0x6568, 0);
	InterruptManagerForKernel_CFFA1857 (0x15, 0x04, 0x65E8, 0);
	sceKernelEnableSubIntr (0x15, 0x05);
	sceKernelEnableSubIntr (0x15, 0x04);
	sceKernelCpuResumeIntrWithSync (intr);
}
void sceDmacplus_driver_4391D45C (){
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xBC800190) = 0;
	sceKernelReleaseSubIntrHandler (0x15, 0x05);
	sceKernelReleaseSubIntrHandler (0x15, 0x04);
	sceKernelDeleteEventFlag (*((int *) 0xD00C));
	sceKernelCpuResumeIntrWithSync (intr);
}
int sceDmacplus_driver_8B6B73F9 (){
	return (!((*((unsigned short *) 0xD70E) & 0x04)) ? 0 : 0xFFFFFFFF);
}
void sceDmacplus_driver_539A58C9 (){
	return;
}
void sceDmacplus_driver_975BB7E2 (){
	return;
}
void sub_06568 (){
	*((int *) 0xBC800190) &= 0xFFFFFFFE;
	*((int *) 0xD010) = *((int *) 0xBC800180);
	*((int *) 0xD014) = *((int *) 0xBC800184);
	*((int *) 0xD018) = *((int *) 0xBC800188);
	*((int *) 0xD01C) = *((int *) 0xBC80018C);
	sceKernelSetEventFlag (*((int *) 0xD00C);, 2);
}
void sub_065E8 (){
	sceKernelSetEventFlag (*((int *) 0xD00C), 1);
	*((short *) 0xD70E) &= 0xFFFFFFFB;
}

/**
 * Subroutine at address 0x6624
 */
void sceDmacplus_driver_21DA182B (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[0] = s0;
	((int *) sp)[2] = s2;
	var1 = 0x80000104;
	((int *) sp)[1] = s1;
	((int *) sp)[4] = ra;
	((int *) sp)[3] = s3;
	if (!(((arg3 < 0x1000)) == 0))
	{
		var4 = sceKernelCpuSuspendIntr ();
		var5 = *((unsigned short *) 0xD70E);
		var6 = arg3 | 0x81909000;
		if ((var5 & 0x0E) != 0)
		{
			sceKernelCpuResumeIntr (var4, 0xFFFFFFFC, var6);
			var1 = 0x80000021;
		}
		else
		{
			var7 = *((int *) 0xD020);
			*((short *) 0xD70E) = (var5 | 0x08);
			*((int *) 0xBC8001A0) = ((arg2 >> 0) & 0x1FFFFFFF);
			*((int *) 0xBC8001A4) = ((arg1 >> 0) & 0x1FFFFFFF);
			*((int *) 0xBC8001A8) = 0;
			*((int *) 0xBC8001AC) = var6;
			*((int *) 0xBC8001B0) = 0xC001;
			sceKernelClearEventFlag (var7, 0xFFFFFFFC);
			sceKernelCpuResumeIntrWithSync (var4);
			var1 = 0;
		}
	}
	ra = ((int *) sp)[4];
	var12 = ((int *) sp)[3];
	var13 = ((int *) sp)[2];
	var14 = ((int *) sp)[1];
	var15 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x6714
 */
void sceDmacplus_driver_1D65E667 (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[4] = s0;
	var1 = arg2;
	((int *) sp)[6] = ra;
	((int *) sp)[5] = s1;
	if (arg1 == 0)
	{
		var17 = *((int *) 0xD020);
		var18 = sp;
		var21 = sceKernelWaitEventFlag (var17, 0x03, 1, var18, 0);
		var8 = var21;

	label10:
		var2 = var8;
		if (var8 < 0)
		{

		label15:
			ra = ((int *) sp)[6];
		}
		else
		{
			var9 = ((int *) sp)[0];
			ra = ((int *) sp)[6];
			if (!((var9 & 2) == 0))
			{
				if (!(var1 == 0))
				{
					var10 = *((int *) 0xD024);
					((int *) var1)[0] = var10;
					var11 = *((int *) 0xD028);
					((int *) var1)[1] = var11;
					var12 = *((int *) 0xD02C);
					((int *) var1)[2] = var12;
					var13 = *((int *) 0xD030);
					((int *) var1)[3] = var13;
				}
				var14 = *((unsigned short *) 0xD70E);
				*((short *) 0xD70E) = ((var14 & 0xFFFFFFF7) | (0 & 1));
				var2 = 0xFFFFFFFF;
				goto label15;
			}
		}
	}
	else
	{
		var2 = 0x80000107;
		if (arg1 != 1)
			goto label15;
		var3 = *((int *) 0xD020);
		var4 = sp;
		var7 = sceKernelPollEventFlag (var3, 0x03, 1, var4);
		var8 = var7;
		var2 = 1;
		if (var7 == 0x800201AF)
			goto label15;
		goto label10;
	}
	var15 = ((int *) sp)[5];
	var16 = ((int *) sp)[4];
	sp = sp + 0x20;
	return;
}
void sceDmacplus_driver_54A776A3 (){
	intr = sceKernelCpuSuspendIntr ();
	*((short *)0xD70E)&= 0xFFFFFFF7;
	*((int *)  0xD020) = sceKernelCreateEventFlag ("SceDmacplusMe2Sc", 0x0201, 1, 0);
	InterruptManagerForKernel_CFFA1857 (0x15, 7, 0x69F0, 0);
	InterruptManagerForKernel_CFFA1857 (0x15, 6, 0x6A70, 0);
	sceKernelEnableSubIntr (0x15, 7);
	sceKernelEnableSubIntr (0x15, 6);
	sceKernelCpuResumeIntrWithSync (intr);
	return;
}
void sceDmacplus_driver_3A5F9CC1 (){
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xBC8001B0) = 0;
	sceKernelReleaseSubIntrHandler (0x15, 7);
	sceKernelReleaseSubIntrHandler (0x15, 6);
	sceKernelDeleteEventFlag (*((int *) 0xD020));
	sceKernelCpuResumeIntrWithSync (intr);
}
int sceDmacplus_driver_4ABEFBC1 (){
	return (*((unsigned short *) 0xD70E) & 0x08) ? -1 : 0);
}
void sceDmacplus_driver_F5F2AD5E (){
	return;
}
void sceDmacplus_driver_A836FBEA (){
	return;
}

/**
 * Subroutine at address 0x6934
 */
void sceDmacplus_driver_24B3E74C (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	((int *) sp)[2] = ra;
	var1 = arg1;
	var4 = sceKernelCpuSuspendIntr ();
	var5 = *((unsigned short *) 0xD70E);
	var6 = var5 | 0x08;
	if ((var5 & 0x0E) != 0)
	{
		sceKernelCpuResumeIntr (var4, 0xFFFFFFFC, var6);
	}
	else
	{
		var7 = ((int *) var1)[0];
		*((short *) 0xD70E) = var6;
		*((int *) 0xBC8001A0) = var7;
		var8 = ((int *) var1)[1];
		var9 = *((int *) 0xD020);
		*((int *) 0xBC8001A4) = var8;
		var10 = ((int *) var1)[2];
		*((int *) 0xBC8001A8) = var10;
		var11 = ((int *) var1)[3];
		*((int *) 0xBC8001AC) = var11;
		*((int *) 0xBC8001B0) = 0xC001;
		sceKernelClearEventFlag (var9, 0xFFFFFFFC);
		sceKernelCpuResumeIntrWithSync (var4);
	}
	ra = ((int *) sp)[2];
	var16 = ((int *) sp)[1];
	var17 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}
void sub_069F0 (){
	*((int *) 0xBC8001B0) &= 0xFFFFFFFE);
	*((int *) 0xD024) = *((int *) 0xBC8001A0);
	*((int *) 0xD028) = *((int *) 0xBC8001A4);
	*((int *) 0xD02C) = *((int *) 0xBC8001A8);
	*((int *) 0xD030) = *((int *) 0xBC8001AC);
	sceKernelSetEventFlag (*((int *) 0xD020), 2);
}
void sub_06A70 (){
	sceKernelSetEventFlag (var1, 1);
	*((short *) 0xD70E) &= 0xFFFFFFF7);
	return;
}
void sceDmacplus_driver_A05CA13D (){
	if (*((unsigned short *) 0xD70E) & 0x10){
		while (1) {
			if (sceDmacplus_driver_6BB2E47C (0x08)){
				sub_06B2C ();
				var10 = 0x08;
			}
			if (!sceDmacplus_driver_6BB2E47C (0x09))continue;
			sub_06B80 ();
			var10 = 0x09;
			break;
		}
		sceDmacplus_driver_1068393E (var10);
	}
}
void sub_06B2C (){
	*((short *) 0xD70E) &= 0xFFFFFFEF;
	sceKernelSetEventFlag (*((int *) 0xD038), 1);
	sceKernelSignalSema (*((int *) 0xD034), 1);
}
void sub_06B80 (){
	*((int *) 0xD03C) = *((int *) 0xBC8001C0);
	*((int *) 0xD040) = *((int *) 0xBC8001C4);
	*((int *) 0xD044) = *((int *) 0xBC8001C8);
	*((int *) 0xD048) = *((int *) 0xBC8001CC);
	*((short*)0xD70E)&= 0xFFFFFFEF;
	sceKernelSetEventFlag (*((int *) 0xD038), 2);
}
void sceDmacplus_driver_AC024305 (int arg1, int arg2, int arg3){
	sub_06C10 (arg1, arg2, arg3, 0);
	return;
}
void sceDmacplus_driver_50FCAA20 (int arg1, int arg2, int arg3){
	sub_06C10 (arg1, arg2, arg3, 1);
	return;
}
/**
 * Subroutine at address 0x6C10
 */
void sub_06C10 (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFC70;
	((int *) sp)[221] = s5;
	var1 = arg1;
	var2 = arg2;
	((int *) sp)[217] = s1;
	var3 = 0;
	var4 = arg3;
	((int *) sp)[225] = ra;
	((int *) sp)[224] = fp;
	((int *) sp)[223] = s7;
	((int *) sp)[222] = s6;
	((int *) sp)[220] = s4;
	((int *) sp)[219] = s3;
	((int *) sp)[218] = s2;
	((int *) sp)[216] = s0;
	((int *) sp)[209] = arg4;
	if (!(arg3 == 0))
	{
		if (!((((arg1 < 1)) | ((arg2 < 1))) != 0))
		{
			var5 = k1;
			k1 = k1 >> 0x10;
			((int *) sp)[211] = var5;
			var6 = k1 & 0x18;
			var7 = ((int *) sp)[211];
			if (((0 - var6) & (((var2 + var4) | var2) | var4)) < 0)
			{

			label69:
				k1 = var7;
			}
			else
			{
				var8 = k1 & 0x18;
				if (((0 - var8) & (((var1 + var4) | var1) | var4)) >= 0)
				{
					var18 = ((((var2 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var2 & 0x1FFFFFFF);
					var19 = ((((var1 >> 0x1F) ^ 1) << 0x1E) & 0xE0000000) | (var1 & 0x1FFFFFFF);
					var20 = CLZ ((BITREV ((((var18 ^ var19) & 0x0F) | 0x10))));
					var21 = (0x00012333 >> (var20 << 2)) & 0x07;
					var22 = 1 << var20;
					var23 = var18 & (var22 + 0xFFFFFFFF);
					var24 = var1 | (((var1 >> 0x1F) + 2) << 0x1D);
					var25 = var2 | (((var2 >> 0x1F) + 2) << 0x1D);
					((int *) sp)[210] = ((((var20 << 0x12) | (var21 << 0x0C)) | 0x0C000000) | ((var20 << 0x15) | (var21 << 0x0F)));
					if (!(var23 == 0))
					{
						var26 = var23 - var22;
						var4 = var4 + var26;
						var18 = var18 - var26;
						var19 = var19 - var26;
						while (1) {
							var27 = ((unsigned char *) var25)[0];
							var26 = var26 + 1;
							var25 = var25 + 1;
							((char *) var24)[0] = var27;
							var24 = var24 + 1;
							if (var26 != 0)
								continue;
							break;
						}
					}
					var28 = var4 & ((1 << var20) + 0xFFFFFFFF);
					if (var28 == 0)
					{
						var32 = (var4 < 0x0101);
					}
					else
					{
						var4 = var4 - var28;
						var29 = var24 + var4;
						var30 = var25 + var4;
						if (!(var28 <= 0))
						{
							while (1) {
								var31 = ((unsigned char *) var30)[0];
								var28 = var28 + 0xFFFFFFFF;
								var30 = var30 + 1;
								((char *) var29)[0] = var31;
								var29 = var29 + 1;
								if (var28 != 0)
									continue;
								break;
							}
						}
						var32 = (var4 < 0x0101);
					}
					if (var32 != 0)
					{
						memcpy (var24, var25, var4);
						var88 = ((int *) sp)[211];
						k1 = var88;
					}
					else
					{
						if (var4 == 0)
						{

						label67:
							var66 = ((int *) sp)[211];
							k1 = var66;
						}
						else
						{
							var33 = sp | 0x3F;
							((int *) sp)[214] = var33;
							var34 = 0x0FFF << var20;
							var35 = ((int *) sp)[214];
							while (1) {
								var36 = 0;
								var37 = (var35 ^ 0x3F) + 0x40;
								var38 = var37;
								((int *) sp)[212] = var18;
								((int *) sp)[213] = var19;
								if (((var34 < var4)) != 0)
								{
									var82 = ((int *) sp)[210];
									var40 = var82 | 0x0FFF;
									var18 = var18 + var34;
									var19 = var19 + var34;
									var4 = var4 - var34;
									var83 = 0;
									while (1) {
										var84 = var38 + 0x10;
										((int *) var38)[0] = var18;
										((int *) var38)[1] = var19;
										if (((var34 < var4)) == 0)
										{
											var85 = ((int *) sp)[210];
											var4 = 0;
											var83 = var83 + 1;
											((int *) var38)[3] = ((var85 | (var4 >> var20)) | 0x80000000);
											((int *) var38)[2] = 0;
										}
										else
										{
											if (var83 == 0x2F)
											{
												((int *) var38)[2] = 0;
												((int *) var38)[3] = (var82 | 0x80000FFF);
											}
											else
											{
												((int *) var38)[2] = ((var84 >> 0) & 0x1FFFFFFF);
												((int *) var38)[3] = var40;
											}
											var83 = var83 + 1;
											var38 = var84;
											var18 = var18 + var34;
											var19 = var19 + var34;
											var4 = var4 - var34;
											if (((var83 < 0x30)) != 0)
												continue;
											break;
										}
									}
									var36 = var83;
								}
								else
								{
									var39 = ((int *) sp)[210];
									var40 = (var39 | (var4 >> var20)) | 0x80000000;
									var37 = 0;
									var4 = 0;
								}
								var41 = ((int *) sp)[209];
								if (var41 != 0)
								{
									var79 = *((int *) 0xD034);
									var45 = sceKernelPollSema (var79, 1);
								}
								else
								{
									var42 = *((int *) 0xD034);
									var45 = sceKernelWaitSema (var42, 1, 0);
								}
								if (var45 < 0)
								{
									var78 = ((int *) sp)[211];
									k1 = var78;
								}
								else
								{
									var46 = var36 + 0x03;
									if (!(var37 == 0))
									{
										var47 = (var46 + ((var46 >> 0x1F) >> 0x1E)) >> 2;
										var48 = var47;
										if (!(var47 <= 0))
										{
											var49 = var37;
											while (1) {
												__asm__ ("cache			0x1A, 0($v0);"
													: 
													: "=r"(var49));
												var48 = var48 + 0xFFFFFFFF;
												var49 = var49 + 0x40;
												if (var48 != 0)
													continue;
												break;
											}
										}
									}
									var52 = sceKernelCpuSuspendIntr ();
									var53 = *((short *) 0xD70E);
									var54 = var52;
									if (var53 < 0)
									{
										while (1) {
											sceKernelCpuResumeIntr (var54, 0xD70C);
											sceDmacplus_driver_0A40EF79 (0, 0);
											var76 = sceKernelCpuSuspendIntr ();
											var77 = *((short *) 0xD70E);
											if (var77 < 0)
												continue;
											break;
										}
									}
									else
									{
									}
									var55 = *((unsigned short *) 0xD70E);
									var56 = ((int *) sp)[212];
									*((short *) 0xD70E) = (var55 | 0x10);
									var57 = ((int *) sp)[213];
									*((int *) 0xBC8001C0) = var56;
									*((int *) 0xBC8001C4) = var57;
									*((int *) 0xBC8001C8) = ((var37 >> 0) & 0x1FFFFFFF);
									*((int *) 0xBC8001CC) = var40;
									*((int *) 0xBC8001D0) = 0xC001;
									sceKernelCpuResumeIntrWithSync (var54);
									var60 = *((int *) 0xD038);
									var61 = sp + 0x0340;
									var64 = sceKernelWaitEventFlag (var60, 0x03, 0x21, var61, 0);
									var3 = var64;
									if (!(var64 != 0))
									{
										var65 = ((int *) sp)[208];
										if ((var65 & 2) != 0)
										{
											var67 = *((int *) 0xD034);
											var3 = 0x80000103;
											sceKernelSignalSema (var67, 1);
										}
									}
									var35 = ((int *) sp)[214];
									if (var4 != 0)
										continue;
									break;
								}
								goto label70;
							}
							goto label67;
						}
					}
				}
				else
				{
					var7 = ((int *) sp)[211];
					goto label69;
				}
			}
		}
	}

label70:
	ra = ((int *) sp)[225];
	var9 = ((int *) sp)[224];
	var10 = ((int *) sp)[223];
	var11 = ((int *) sp)[222];
	var12 = ((int *) sp)[221];
	var13 = ((int *) sp)[220];
	var14 = ((int *) sp)[219];
	var15 = ((int *) sp)[218];
	var16 = ((int *) sp)[217];
	var17 = ((int *) sp)[216];
	sp = sp + 0x0390;
	return;
}
void sceDmacplus_driver_48632A5F (int arg1){
	if (sceKernelWaitSema (*((int *) 0xD034), 1, 0) < 0)return;
	var5 = (0xA0000000 & 0xE0000000) | (arg1 & 0x1FFFFFFF);
	*((int *) 0xBC8001C0) = ((int *) var5)[0];
	*((int *) 0xBC8001C4) = ((int *) var5)[1];
	*((int *) 0xBC8001C8) = ((int *) var5)[2];
	*((int *) 0xBC8001CC) = ((int *) var5)[3];
	*((int *) 0xBC8001D0) = 0xC001;
	__asm__ ("sync;");
	int*var11;
	if (sceKernelWaitEventFlag (*((int *) 0xD038), 0x03, 0x21,&var11, 0))return;
	if (!(var11 & 2))return;
	sceKernelSignalSema (*((int *) 0xD034), 1);
}
void sceDmacplus_driver_4DB8CA36 (){
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xD034) = sceKernelCreateSema (0xB91C, 1, 1, 1, 0);
	*((int *) 0xD038) = sceKernelCreateEventFlag (0xB91C, 0x0201, 0, 0);
	InterruptManagerForKernel_CFFA1857 (0x15, 0x08, 0x6B2C, 0);
	InterruptManagerForKernel_CFFA1857 (0x15, 0x09, 0x6B80, 0);
	sceKernelEnableSubIntr (0x15, 0x08);
	sceKernelEnableSubIntr (0x15, 0x09);
	sceKernelCpuResumeIntr (intr);
}
void sceDmacplus_driver_5FEC19EE (){
	intr = sceKernelCpuSuspendIntr ();
	*((int *) 0xBC8001D0) = 0;
	sceKernelReleaseSubIntrHandler (0x15, 0x08);
	sceKernelReleaseSubIntrHandler (0x15, 0x09);
	sceKernelDeleteSema (*((int *) 0xD034));
	sceKernelDeleteEventFlag (*((int *) 0xD038));
	sceKernelCpuResumeIntr (intr);
}
int sceDmacplus_driver_9C57AB36 (){
	return 0;
}
void sceDmacplus_driver_7A9001AF (){
	return;
}
void sceLcdc_driver_9182FB30 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	((int *) sp)[3] = ra;
	memset (0xD04C, 0, 0x48);
	*((int *) 0xD04C) = 1;
	sceSysreg_driver_F092AED8 ();
	sceSysreg_driver_BEF287D5 ();
	var9 = sceSysregGetTachyonVersion ();
	if (((0x004FFFFF < var9)) != 0)
	{
		*((int *) 0xD058) = 0x03;
		*((int *) 0xBB0C) = 0xFFFFFFFF;
		*((char *) 0xBBA1) = 1;
		*((int *) 0xD050) = 1;
		*((int *) 0xD054) = 1;
		*((int *) 0xBE140070) = 1;
		*((char *) 0xBAC1) = 1;
		*((char *) 0xBADC) = 1;
		*((char *) 0xBADD) = 1;
		*((int *) 0xBAF0) = 0xFFFFFFFF;
		*((char *) 0xBB30) = 1;
		*((char *) 0xBB31) = 1;
		*((char *) 0xBB4C) = 1;
		*((char *) 0xBB4D) = 1;
		*((char *) 0xBB68) = 1;
		*((char *) 0xBB69) = 1;
		*((char *) 0xBB85) = 1;
		*((char *) 0xBBA0) = 1;
	}
	else
	{
		*((int *) 0xD058) = 1;
	}
	var10 = *((int *) 0xBE140004);
	var11 = *((int *) 0xBE140008);
	__asm__ ("lwc1			 $fpr01, -17992($t1);");
	var12 = *((int *) 0xBE140010);
	var13 = *((int *) 0xBE140014);
	var14 = *((int *) 0xBE140018);
	var15 = *((int *) 0xBE14001C);
	var16 = *((int *) 0xBE140020);
	var17 = *((int *) 0xBE140024);
	var18 = *((int *) 0xBE140028);
	var19 = *((int *) 0xBE14002C);
	var20 = 0xD04C;
	*((int *) 0xD068) = var11;
	*((short *) 0xD07A) = var12;
	*((short *) 0xD07C) = var13;
	*((short *) 0xD078) = var14;
	*((short *) 0xD07E) = var15;
	*((short *) 0xD082) = var16;
	*((short *) 0xD084) = var17;
	*((short *) 0xD080) = var18;
	*((short *) 0xD086) = var19;
	__asm__ ("swc1			 $fpr01, 36($t5);"
		: 
		: "=r"(0xD04C));
	*((short *) 0xD076) = var10;
	if ((var10 & 0xFFFF) != 0)
	{
		var56 = *((int *) 0xBE140048);
		var57 = *((int *) 0xBE14004C);
		var58 = *((int *) 0xBE140040);
		var59 = *((int *) 0xBE140044);
		*((int *) 0xD060) = var56;
		*((int *) 0xD08C) = var59;
		*((int *) 0xD064) = var57;
		*((int *) 0xD090) = var58;
	}
	else
	{
		var21 = *((int *) 0xBE14001C);
		var22 = *((int *) 0xBE14002C);
		*((int *) 0xD060) = var21;
		*((int *) 0xD064) = var22;
	}
	var23 = *((int *) 0xD050);
	if (!(var23 == 0))
	{
		var24 = *((int *) 0xBC100060);
		var25 = var24 & 0x00300000;
		*((char *) 0xD074) = ((var24 >> 22) & 1);
		if (var25 == 0x00100000)
		{
			var26 = 1;

		label23:
			*((char *) 0xD075) = var26;

		label24:
		}
		else
		{
			if (((0x00100000 < var25)) != 0)
			{
				if (!(var25 != 0x00200000))
				{
					var26 = 2;
					goto label23;
				}
			}
			else
			{
				var26 = 0x03;
				if (var25 == 0)
					goto label23;
				goto label24;
			}
		}
	}
	var36 = *((int *) 0xD058);
	unsigned short * var37 = 0xBAB8;
	i = 0;
	while (1) {
		i = i + 1;
		if ((((0xD078 + 0xD07A) + 0xD07C) + 0xD07E) == ((((var37[6] + var37[7]) + var37[8]) + var37[9]) * var36)){
			label34:
				var37+=0x1C;
				if (i < 0x0C)continue;
				break;
			if ((((0xD080 + 0xD082) + 0xD084) + 0xD086) == (((var37)[10] +  var37)[11]) + var37)[12]) + var37)[13])){
				if (0xD082 !=  var37[11])goto label34;
				__asm__ ("lwc1			 $fpr02, 4($a1);");
				var53 = ((int *) var37)[0];
				__asm__ ("swc1			 $fpr02, 36($t6);":"=r"(0xD04C));
				*((int *) 0xD05C) = var53;
				if (var53){
					if (*0xD076){
						var55 = *((unsigned short *) 0xD07C);
						if (!var36)__asm__ ("break			0x7;");
						*((int *) 0xD088) = ((var55 / var36) - var41);
					}
				}
			}
		}
	}
	*((int *) 0xBE140000) |= 3;
	sceKernelRegisterSysEventHandler (0xBE84);
	return;
}

/**
 * Subroutine at address 0x7638
 */
void sceLcdc_driver_88EC8DFE ()//init
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[3] = ra;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	sceSysreg_driver_280F9241 ();
	var3 = *((unsigned char *) 0xBAC1);
	sceSysreg_driver_8FA2F8C0 (0, var3);
	sceSysreg_driver_F092AED8 ();
	var8 = *((int *) 0xD068);
	var9 = *((int *) 0xD090);
	var10 = *((int *) 0xD08C);
	var11 = *((int *) 0xD060);
	var12 = *((int *) 0xD064);
	var13 = *((unsigned short *) 0xD076);
	var14 = *((unsigned short *) 0xD07A);
	var15 = *((unsigned short *) 0xD07C);
	var16 = *((unsigned short *) 0xD078);
	var17 = *((unsigned short *) 0xD07E);
	var18 = *((unsigned short *) 0xD082);
	var19 = *((unsigned short *) 0xD084);
	var20 = *((unsigned short *) 0xD080);
	var21 = *((unsigned short *) 0xD086);
	*((int *) 0xBE140004) = var13;
	*((int *) 0xBE140008) = var8;
	*((int *) 0xBE140010) = var14;
	*((int *) 0xBE140014) = var15;
	*((int *) 0xBE140018) = var16;
	*((int *) 0xBE14001C) = var17;
	*((int *) 0xBE140020) = var18;
	*((int *) 0xBE140024) = var19;
	*((int *) 0xBE140028) = var20;
	*((int *) 0xBE14002C) = var21;
	*((int *) 0xBE140040) = var9;
	*((int *) 0xBE140044) = var10;
	*((int *) 0xBE140048) = var11;
	*((int *) 0xBE14004C) = var12;
	var22 = *((int *) 0xBE140000);
	var23 = *((int *) 0xD054);
	*((int *) 0xBE140000) = (var22 | 0x03);
	if (!(var23 == 0))
	{
		*((int *) 0xBE140070) = 1;
	}
	sceSysreg_driver_280F9241 ();
	var26 = *((unsigned char *) 0xD075);
	var27 = *((unsigned char *) 0xD074);
	sceSysreg_driver_8FA2F8C0 (var27, var26);
	sceSysreg_driver_F092AED8 ();
	var32 = *((int *) 0xD04C);
	if (var32 != 0)
	{
		sceSysreg_driver_BEF287D5 ();
		ra = ((int *) sp)[3];
	}
	else
	{
		ra = ((int *) sp)[3];
	}
	var33 = ((int *) sp)[2];
	var34 = ((int *) sp)[1];
	var35 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x7760
 */
int sceLcdc_driver_B730DAE0 (int arg1, int arg2, int arg3, int arg4)
{
	var1 = 0x80000108;
	if (!(((arg4 < 0x04)) == 0))
	{
		var2 = 0xBAB8;
		var3 = 0;
		var4 = 0xBAB8;
		var5 = *((int *) 0xBAB8);
		while (1) {
			var3 = var3 + 1;
			var6 = var4;
			var2 = var2 + 0x1C;
			var4 = var4 + 0x1C;
			if (var5 == arg1)
				break;
			if (((var3 < 0x0C)) != 0)
			{
				var5 = ((int *) var2)[0];
				continue;
			}
			else
			{
				var6 = 0;
			}
		}
		var1 = 0x80000107;
		if (!(var6 == 0))
		{
			if (((arg2 < 0x01E0)) == 0)
			{
				var10 = ((unsigned short *) var6)[9];
				var1 = 0x80000104;
				if (((var10 < arg2)) == 0)
				{

				label14:
					var1 = 0x80000104;
					if (!((arg2 & 0x03) != 0))
					{
						if (((arg3 < 0x0110)) == 0)
						{
							var9 = ((unsigned short *) var6)[13];
							var1 = 0x80000104;
							if (((var9 < arg3)) == 0)
							{

							label20:
								var1 = 0;
							}
							else
							{
							}
						}
						else
						{
							var8 = ((unsigned short *) var6)[13];
							var1 = 0x80000104;
							if (!(((var8 < 0x0110)) == 0))
								goto label20;
						}
					}
				}
				else
				{
				}
			}
			else
			{
				var7 = ((unsigned short *) var6)[9];
				var1 = 0x80000104;
				if (!(((var7 < 0x01E0)) == 0))
					goto label14;
			}
		}
	}
	return var1;
}

/**
 * Subroutine at address 0x7840
 */
void sceLcdc_driver_E2761BFB (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFFD0;
	((int *) sp)[5] = s5;
	((int *) sp)[4] = s4;
	((int *) sp)[3] = s3;
	var1 = arg1;
	((int *) sp)[2] = s2;
	((int *) sp)[8] = ra;
	((int *) sp)[7] = s7;
	((int *) sp)[6] = s6;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var4 = sceLcdc_driver_B730DAE0 (arg1, arg2, arg3, arg4);
	var5 = var4;
	if (!(var4 < 0))
	{
		var6 = *((int *) 0xD058);
		var7 = 0xBAB8;
		var8 = 0xBAB8;
		var9 = 0;
		var10 = *((int *) 0xBAB8);
		while (1) {
			var9 = var9 + 1;
			var11 = var8;
			var7 = var7 + 0x1C;
			var8 = var8 + 0x1C;
			if (var10 == var1)
				break;
			if (((var9 < 0x0C)) != 0)
			{
				var10 = ((int *) var7)[0];
				continue;
			}
			else
			{
				var11 = 0;
			}
		}
		var14 = sceKernelCpuSuspendIntr ();
		*((int *) 0xD060) = (arg2 * var6);
		*((int *) 0xD064) = arg3;
		*((int *) 0xD068) = arg4;
		*((int *) 0xD05C) = var1;
		var15 = *((unsigned short *) 0xD074);
		var16 = ((unsigned short *) var11)[4];
		if (!(var15 == var16))
		{
			sceSysreg_driver_280F9241 ();
			var19 = ((unsigned char *) var11)[8];
			var20 = ((unsigned char *) var11)[9];
			sceSysreg_driver_8FA2F8C0 (var19, var20);
			sceSysreg_driver_F092AED8 ();
		}
		var25 = ((int *) var11)[0];
		var26 = *((int *) 0xD058);
		*((int *) 0xD06C) = var25;
		var27 = ((int *) var11)[1];
		*((int *) 0xD070) = var27;
		var28 = ((int *) var11)[2];
		*((int *) 0xD074) = var28;
		var29 = ((int *) var11)[3];
		*((int *) 0xD078) = var29;
		var30 = ((int *) var11)[4];
		*((int *) 0xD07C) = var30;
		var31 = ((int *) var11)[5];
		*((int *) 0xD080) = var31;
		var32 = ((int *) var11)[6];
		*((int *) 0xD084) = var32;
		if (!(var26 == 1))
		{
			var33 = *((unsigned short *) 0xD07A);
			var34 = *((unsigned short *) 0xD07E);
			var35 = *((unsigned short *) 0xD07C);
			var36 = *((unsigned short *) 0xD078);
			*((short *) 0xD07A) = (var33 * var26);
			*((short *) 0xD07E) = (var34 * var26);
			*((short *) 0xD07C) = (var35 * var26);
			*((short *) 0xD078) = (var36 * var26);
		}
		var37 = *((unsigned short *) 0xD076);
		if (var37 == 1)
		{
			var92 = *((unsigned short *) 0xD07E);
			var93 = *((int *) 0xD060);
			if (var92 == var93)
			{
				*((short *) 0xD076) = 0;

			label26:
			}
			else
			{
			}
		}
		else
		goto label26;
		var38 = *((unsigned short *) 0xD076);
		if (var38 != 0)
		{
			var73 = *((unsigned short *) 0xD086);
			var74 = *((int *) 0xD064);
			var75 = *((unsigned short *) 0xD07E);
			var76 = *((int *) 0xD060);
			var77 = (var73 & 0xFFFF) - var74;
			var78 = (var75 & 0xFFFF) - var76;
			var79 = !((var1 ^ 6)) ? 0 : ((var77 + (var77 >> 0x1F)) >> 1);
			if (!(var79 != 0))
			{
				var80 = *((unsigned short *) 0xD084);
				*((short *) 0xD086) = (var73 + 1);
				var79 = 1;
				*((short *) 0xD084) = (var80 + 0xFFFFFFFF);
			}
			var81 = *((int *) 0xD058);
			var82 = var81 << 0x03;
			if (var82 == 0)
			{
				__asm__ ("break			0x7;");
			}
			var83 = ((((var78 + (var78 >> 0x1F)) >> 1) / var82) * var82);
			if (((var83 < 0xF0)) != 0)
			{
			}
			else
			{
				var84 = *((unsigned short *) 0xD07C);
				var85 = var83 + 0xFFFFFF10;
				var86 = var84 + var85;
				var87 = var86 & 0xFFFF;
				*((short *) 0xD07E) = (var75 - var85);
				var83 = 0xF0;
				*((short *) 0xD07C) = var86;
				if (!(((var87 < 0x0100)) != 0))
				{
					var88 = *((int *) 0xD050);
					*((short *) 0xD07C) = 0xFF;
					var89 = var87 + 0xFFFFFF01;
					if (!(var88 == 0))
					{
						var90 = *((unsigned short *) 0xD07A);
						*((short *) 0xD07A) = (var90 + var89);
						var89 = 0;
					}
					var91 = *((unsigned short *) 0xD07E);
					*((short *) 0xD07E) = (var91 + var89);
				}
			}
			*((int *) 0xD08C) = var83;
			*((int *) 0xD090) = var79;
		}
		else
		{
			var39 = *((int *) 0xD05C);
			*((int *) 0xD090) = 0;
			var40 = 0;
			*((int *) 0xD08C) = 0;
			if (!(var39 == 0))
			{
				var41 = *((int *) 0xD058);
				var42 = *((int *) 0xD088);
				var40 = (var42 * var41);
			}
			var43 = *((unsigned short *) 0xD086);
			var44 = *((unsigned short *) 0xD07C);
			var45 = *((unsigned short *) 0xD078);
			var46 = *((int *) 0xD064);
			*((short *) 0xD07C) = (var44 + var40);
			*((short *) 0xD078) = (var45 - var40);
			if (!(((var46 < (var43 & 0xFFFF))) == 0))
			{
				var47 = *((unsigned short *) 0xD064);
				var48 = *((unsigned short *) 0xD080);
				*((short *) 0xD086) = var47;
				*((short *) 0xD080) = (var48 + (var43 - var47));
			}
		}
		var49 = *((int *) 0xD068);
		var50 = *((int *) 0xD090);
		var51 = *((int *) 0xD08C);
		var52 = *((int *) 0xD060);
		var53 = *((int *) 0xD064);
		var54 = *((unsigned short *) 0xD076);
		var55 = *((unsigned short *) 0xD07A);
		var56 = *((unsigned short *) 0xD07C);
		var57 = *((unsigned short *) 0xD078);
		var58 = *((unsigned short *) 0xD07E);
		var59 = *((unsigned short *) 0xD082);
		var60 = *((unsigned short *) 0xD084);
		var61 = *((unsigned short *) 0xD080);
		var62 = *((unsigned short *) 0xD086);
		*((int *) 0xBE140004) = var54;
		*((int *) 0xBE140008) = var49;
		*((int *) 0xBE140010) = var55;
		*((int *) 0xBE140014) = var56;
		*((int *) 0xBE140018) = var57;
		*((int *) 0xBE14001C) = var58;
		*((int *) 0xBE140020) = var59;
		*((int *) 0xBE140024) = var60;
		*((int *) 0xBE140028) = var61;
		*((int *) 0xBE14002C) = var62;
		*((int *) 0xBE140040) = var50;
		*((int *) 0xBE140044) = var51;
		*((int *) 0xBE140048) = var52;
		*((int *) 0xBE14004C) = var53;
		if (var1 == 0x0E)
		{
			*((int *) 0xD054) = 0;
			*((int *) 0xBE140070) = 0;
		}
		sceKernelCpuResumeIntr (var14, var49, 0xD04C);
		var5 = 0;
	}
	ra = ((int *) sp)[8];
	var65 = ((int *) sp)[7];
	var66 = ((int *) sp)[6];
	var67 = ((int *) sp)[5];
	var68 = ((int *) sp)[4];
	var69 = ((int *) sp)[3];
	var70 = ((int *) sp)[2];
	var71 = ((int *) sp)[1];
	var72 = ((int *) sp)[0];
	sp = sp + 0x30;
	return;
}

/**
 * Subroutine at address 0x7BEC
 */
void sceLcdc_driver_46936BAA (int arg1, int arg2, int arg3, int arg4)
{
	if (!(arg1 == 0))
	{
		var1 = *((int *) 0xD05C);
		((int *) arg1)[0] = var1;
	}
	if (!(arg2 == 0))
	{
		var2 = *((int *) 0xD058);
		var3 = *((int *) 0xD060);
		if (var2 == 0)
		{
			__asm__ ("break			0x7;");
		}
		((int *) arg2)[0] = (var3 / var2);
	}
	if (!(arg3 == 0))
	{
		var4 = *((int *) 0xD064);
		((int *) arg3)[0] = var4;
	}
	if (!(arg4 == 0))
	{
		var5 = *((int *) 0xD068);
		((int *) arg4)[0] = var5;
	}
	return;
}

/**
 * Subroutine at address 0x7C50
 */
void sceLcdc_driver_CB66284F (int arg1, int arg2, int arg3, int arg4, int arg5)
{
	if (!(arg1 == 0))
	{
		var1 = *((unsigned short *) 0xD080);
		((int *) arg1)[0] = var1;
	}
	if (!(arg2 == 0))
	{
		var2 = *((unsigned short *) 0xD082);
		((int *) arg2)[0] = var2;
	}
	if (!(arg3 == 0))
	{
		var3 = *((unsigned short *) 0xD084);
		((int *) arg3)[0] = var3;
	}
	if (!(arg4 == 0))
	{
		var4 = *((unsigned short *) 0xD080);
		var5 = *((unsigned short *) 0xD082);
		var6 = *((unsigned short *) 0xD084);
		((int *) arg4)[0] = ((var4 + var5) + var6);
	}
	if (!(arg5 == 0))
	{
		var7 = *((unsigned short *) 0xD080);
		var8 = *((unsigned short *) 0xD082);
		var9 = *((unsigned short *) 0xD084);
		var10 = *((unsigned short *) 0xD086);
		((int *) arg5)[0] = (((var7 + var8) + var9) + var10);
	}
	return;
}

/**
 * Subroutine at address 0x7CDC
 */
void sceLcdc_driver_75EAAE61 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = ra;
	((int *) sp)[0] = s0;
	var3 = sceKernelCpuSuspendIntr ();
	var4 = 1;
	while (1) {
		var5 = 0xFFFFFFFF;
		if (((var4 < 0x65)) == 0)
			break;
		var5 = *((int *) 0xBE140030);
		var6 = *((int *) 0xBE140030);
		var4 = var4 + 1;
		if (var6 != var5)
			continue;
		break;
	}
	sceKernelCpuResumeIntr (var3, var6);
	ra = ((int *) sp)[1];
	var9 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}
void sceLcdc_driver_AB398E0D (){
	var3 = sceKernelCpuSuspendIntr ();
	for(int i=1;i<4;i++) {
		if (*((int *) 0xBE140034) == *((int *) 0xBE140034))break;
	}
	sceKernelCpuResumeIntr (var3, var6);
}
void sub_07DB4 (){
	sceKernelUnregisterSysEventHandler (0xBE84);
}
void sceLcdc_driver_FCA0D3AF (){
	sceKernelUnregisterSysEventHandler (0xBE84);
}
void sceLcdc_driver_0C5D83DF (){
	sceSysreg_driver_FF6D37E7 ();
	sceSysreg_driver_280F9241 ();
}
void sceLcdc_driver_668B0E11 (){
	sceSysreg_driver_BEF287D5 ();
}
void sceLcdc_driver_83DD6210 (){
	sceSysreg_driver_FF6D37E7 ();
}
void sceLcdc_driver_AFF57718 (int arg1, int arg2){
	var1 = arg2;
	var4 = sceKernelCpuSuspendIntr ();
	var5 = *((int *) 0xD05C);
	var6 = *((int *) 0xD088);
	*((int *) 0xD088) = var1;
	if (!(var5 == 0))
	{
		var7 = *((unsigned short *) 0xD076);
		if (!(var7 != 0))
		{
			var8 = *((int *) 0xD058);
			var9 = *((unsigned short *) 0xD078);
			var10 = *((unsigned short *) 0xD07C);
			var11 = *((unsigned short *) 0xD07E);
			var12 = ((var1 - var6) * var8);
			var13 = var9 - var12;
			*((int *) 0xBE140018) = (var13 & 0xFFFF);
			*((short *) 0xD07C) = (var10 + var12);
			*((int *) 0xBE14001C) = var11;
			*((short *) 0xD078) = var13;
		}
	}
	sceKernelCpuResumeIntr (var4, var8, var12);
}
void sceLcdcReset (){//sceLcdc_driver_ABE22CB0
	var3 = sceKernelCpuSuspendIntr ();
	var4 = *((int *) 0xBE140000);
	*((int *) 0xBE140000) = (var4 & 0xFFFFFFFE);
	*((int *) 0xBE140000) = var4;
	sceKernelCpuResumeIntr (var3);
}

/**
 * Subroutine at address 0x7F48
 */
void sceLcdc_driver_6DD61A32 ()
{
	__asm__ ("lwc1			 $fpr00, 12($v1);"
					 "lwc1			 $fpr03, 36($v1);"
					 "cvt.s.w		$fpr04, $fpr00;");
	__asm__ ("mul.s			$fpr00, $fpr03, $fpr04;");
	return;
}

/**
 * Subroutine at address 0x7F64
 */
void sceLcdc_driver_61C21DCE ()
{
	var1 = *((int *) 0xD058);
	return;
}

/**
 * Subroutine at address 0x7F70
 */
void sceLcdc_driver_55BD62D7 ()
{
	__asm__ ("lwc1			 $fpr00, -12176($v1);");
	return;
}

/**
 * Subroutine at address 0x7F7C
 */
void sceLcdc_driver_813257DC ()
{
	var1 = *((unsigned short *) 0xD078);
	var2 = *((unsigned short *) 0xD07A);
	var3 = *((unsigned short *) 0xD07C);
	__asm__ ("lwc1			 $fpr04, 12($a2);");
	var4 = *((unsigned short *) 0xD07E);
	__asm__ ("cvt.s.w		$fpr05, $fpr04;");
	var5 = ((var1 + var2) + var3) + var4;
	__asm__ ("lwc1			 $fpr02, 36($a2);"
					 "mtc1			 $v0, $fpr1;"
					 "mul.s			$fpr04, $fpr02, $fpr05;"
					 "cvt.s.w		$fpr03, $fpr01;"
		: 
		: "=r"(var5));
	__asm__ ("div.s			$fpr00, $fpr04, $fpr03;");
	return;
}

/**
 * Subroutine at address 0x7FC0
 */
void sceLcdc_driver_90960D49 ()
{
	var1 = *((unsigned short *) 0xD078);
	var2 = *((unsigned short *) 0xD07A);
	var3 = *((unsigned short *) 0xD080);
	var4 = *((unsigned short *) 0xD082);
	var5 = *((unsigned short *) 0xD07C);
	var6 = *((unsigned short *) 0xD084);
	var7 = *((unsigned short *) 0xD086);
	var8 = *((unsigned short *) 0xD07E);
	__asm__ ("lwc1			 $fpr02, 12($t3);"
					 "lwc1			 $fpr05, 36($t3);"
					 "cvt.s.w		$fpr06, $fpr02;");
	var9 = ((((var1 + var2) + var5) + var8) * (((var3 + var4) + var6) + var7));
	__asm__ ("mtc1			 $v1, $fpr1;"
					 "mul.s			$fpr03, $fpr05, $fpr06;"
					 "cvt.s.w		$fpr04, $fpr01;"
		: 
		: "=r"(var9));
	__asm__ ("div.s			$fpr00, $fpr03, $fpr04;");
	return;
}

/**
 * Subroutine at address 0x8028
 */
void sceLcdc_driver_244FA9A4 ()
{
	var1 = *((int *) 0xBE140050);
	if (var1 == 1)
	{
		*((int *) 0xBE140050) = var1;
	}
	return;
}

/**
 * Subroutine at address 0x8050
 */
void sub_08050 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	if (arg1 == 0x4004)
	{
		sceSysreg_driver_FF6D37E7 ();
		sceSysreg_driver_280F9241 ();
		ra = ((int *) sp)[0];
	}
	else
	{
		if (arg1 == 0x00010004)
		{
			sceLcdc_driver_88EC8DFE ();
			ra = ((int *) sp)[0];
		}
		else
		{
			ra = ((int *) sp)[0];
		}
	}
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x80A8
 */
void sceNandInit ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[3] = ra;
	((int *) sp)[0] = s0;
	memset (0xD094, 0, 0x40);
	sceSysregEmcsmBusClockEnable ();
	sceSysregEmcsmIoEnable ();
	var9 = sceKernelCreateMutex (0xB938, 0x0801, 0, 0);
	*((int *) 0xD094) = var9;
	var12 = sceKernelCreateEventFlag (0xB938, 1, 0, 0);
	*((int *) 0xD098) = var12;
	var15 = KDebugForKernel_E892D9A1 ();
	*((int *) 0xD09C) = 0;
	*((int *) 0xD0A0) = var15;
	*((int *) 0xBD101038) = 0x0303;
	var18 = sceSysregGetTachyonVersion ();
	if (((0x004FFFFF < var18)) != 0)
	{
		*((int *) 0xD0CC) = 0x0B060309;
	}
	else
	{
		*((int *) 0xD0CC) = 0x0B040205;
	}
	var19 = *((int *) 0xD0CC);
	*((int *) 0xBD101200) = var19;
	sceKernelRegisterIntrHandler (0x14, 2, 0x8210, 0, 0);
	sceKernelEnableIntr (0x14);
	sceKernelRegisterSysEventHandler (0xBEC4);
	sceNandLock (0);
	var30 = sub_08200 ();
	if (var30 != 0)
	{
		sceNandReset (0);
		sceNandDetectChip ();
	}
	else
	{
		*((int *) 0xD0C8) = 1;
	}
	sceNandUnlock ();
	ra = ((int *) sp)[3];
	var33 = ((int *) sp)[2];
	var34 = ((int *) sp)[1];
	var35 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x8200
 */
int sub_08200 (){
	return (*((int *) 0xBD101004) & 1);
}

/**
 * Subroutine at address 0x8210
 */
void sub_08210 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = ra;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = *((int *) 0xBD101038);
	*((int *) 0xBD101038) = ((((var1 & 0xFFFFFFFC) | (0 & 0x03)) | ((var1 & (var1 >> 0x08)) & 0x03)) | 0x0300);
	__asm__ ("sync;");
	var2 = *((int *) 0xD0A4);
	if (var2 == 0x03)
	{
		var43 = *((int *) 0xD0BC);
		var44 = *((int *) 0xD0B8);
		var45 = *((int *) 0xD0B0);
		var46 = *((int *) 0xD0B4);
		var49 = sub_090B0 (var43, var45, var46, var44);
		var50 = *((int *) 0xD0A8);
		var51 = *((int *) 0xD0B0);
		var52 = *((int *) 0xD0B4);
		*((int *) 0xD0A8) = (var50 | var49);
		*((int *) 0xD0B0) = (var51 + 1);
		if (!(var52 == 0))
		{
			*((int *) 0xD0B4) = (var52 + 0x0200);
		}
		var53 = *((int *) 0xD0B8);
		if (var53 == 0)
		{
		}
		else
		{
			var54 = *((int *) 0xD0BC);
			var55 = var53 + 0x10;
			if (!((var54 & 1) != 0))
			{
				var55 = var53 + 0x0C;
			}
			*((int *) 0xD0B8) = var55;
		}
		var56 = *((int *) 0xD0AC);
		var57 = var56 + 0xFFFFFFFF;
		*((int *) 0xD0AC) = var57;
		if (var57 <= 0)
		{

		label64:
		}
		else
		{
			var60 = sub_08200 ();
			if (var60 == 0)
			{
				var66 = *((int *) 0xBD101038);
				*((int *) 0xBD101038) = (var66 & 0xFFFFFDFC);
				var69 = sub_08200 ();
				if (var69 == 0)
				{
					var42 = 1;

				label44:
					*((int *) 0xD0A4) = var42;
					goto label64;
				}
				else
				{
					var70 = *((int *) 0xBD101038);
					*((int *) 0xBD101038) = (((var70 & 0xFFFFFFFE) | (0 & 1)) | 0x0202);

				label21:
					var61 = *((int *) 0xD0BC);
					*((int *) 0xD0A4) = 0x03;
					var62 = *((int *) 0xD0B0);
					if ((var61 & 0x10) == 0)
					{
						var65 = *((int *) 0xBD101000);
						var64 = var65 | 0x00010000;
					}
					else
					{
						var63 = *((int *) 0xBD101000);
						var64 = (var63 & 0xFFFEFFFF) | (0 & 1);
					}
					*((int *) 0xBD101000) = var64;
					var20 = var62 << 0x0A;

				label57:
					*((int *) 0xBD101020) = var20;
					var21 = *((int *) 0xBD101038);
					*((int *) 0xBD101038) = (var21 & 0xFFFFFEFC);
					*((int *) 0xBD101024) = 0x0301;
				}
			}
			else
			goto label21;
		}

	label65:
		var4 = *((int *) 0xD0AC);
	}
	else
	{
		if (((var2 < 0x04)) == 0)
		{
			if (var2 != 0x04)
			{

			label49:
				var23 = *((int *) 0xD0A4);
				Kprintf ("PANIC: EMC_SM interrupt occured!! (%08X, %08X)\n", var23);
				goto label65;
			}
			else
			{
				var26 = *((int *) 0xBD101028);
				var27 = *((int *) 0xD0A8);
				var28 = *((int *) 0xD0B0);
				var29 = *((int *) 0xD0B4);
				*((int *) 0xD0A8) = (var27 | ((0 < var26)));
				*((int *) 0xD0B0) = (var28 + 1);
				if (!(var29 == 0))
				{
					*((int *) 0xD0B4) = (var29 + 0x0200);
				}
				var30 = *((int *) 0xD0B8);
				if (var30 == 0)
				{
				}
				else
				{
					var31 = *((int *) 0xD0BC);
					if ((var31 & 1) == 0)
					{
						*((int *) 0xD0B8) = (var30 + 0x0C);
					}
					else
					{
						*((int *) 0xD0B8) = (var30 + 0x10);
					}
				}
				var32 = *((int *) 0xD0AC);
				var33 = var32 + 0xFFFFFFFF;
				*((int *) 0xD0AC) = var33;
				if (var33 <= 0)
					goto label64;
				var36 = sub_08200 ();
				if (var36 == 0)
				{
					var37 = *((int *) 0xBD101038);
					*((int *) 0xBD101038) = (var37 & 0xFFFFFDFC);
					var40 = sub_08200 ();
					if (var40 == 0)
					{
						var42 = 2;
						goto label44;
					}
					else
					{
						var41 = *((int *) 0xBD101038);
						*((int *) 0xBD101038) = (((var41 & 0xFFFFFFFE) | (0 & 1)) | 0x0202);

					label46:
						var10 = *((int *) 0xD0B8);
						var11 = *((int *) 0xD0BC);
						var12 = *((int *) 0xD0B0);
						var13 = *((int *) 0xD0B4);
						*((int *) 0xD0A4) = 0x04;

					label61:
						sub_092D4 (var11, var12, var13, var10);
						var4 = *((int *) 0xD0AC);
					}
				}
				else
				goto label46;
			}
		}
		else
		{
			if (var2 < 0)
			{
				goto label49;
			}
			else
			{
				var3 = *((int *) 0xD0A4);
				if (var3 == 1)
				{
					var16 = *((int *) 0xD0BC);
					*((int *) 0xD0A4) = 0x03;
					var17 = *((int *) 0xD0B0);
					if ((var16 & 0x10) == 0)
					{
						var22 = *((int *) 0xBD101000);
						var19 = var22 | 0x00010000;
					}
					else
					{
						var18 = *((int *) 0xBD101000);
						var19 = (var18 & 0xFFFEFFFF) | (0 & 1);
					}
					var20 = var17 << 0x0A;
					*((int *) 0xBD101000) = var19;
					goto label57;
				}
				else
				{
					if (!(var3 == 2))
						goto label64;
					var10 = *((int *) 0xD0B8);
					var11 = *((int *) 0xD0BC);
					var12 = *((int *) 0xD0B0);
					var13 = *((int *) 0xD0B4);
					*((int *) 0xD0A4) = 0x04;
					goto label61;
				}
			}
		}
	}
	if (var4 == 0)
	{
		var7 = *((int *) 0xD098);
		sceKernelSetEventFlag (var7, 1);
		*((int *) 0xD0A4) = 0xFFFFFFFF;
	}
	ra = ((int *) sp)[2];
	var5 = ((int *) sp)[1];
	var6 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x858C
 */
void sceNandSetWriteProtect (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[2] = ra;
	((int *) sp)[0] = s0;
	var1 = *((int *) 0xBD101004);
	if (arg1 == 0)
	{
		*((int *) 0xBD101004) = (var1 | 0x80);
		while (1) {
			var4 = *((int *) 0xBD101004);
			if ((var4 & 0x80) == 0)
				continue;
			break;
		}
		*((int *) 0xD0C0) = 1;
		var7 = sceKernelGetSystemTimeLow ();
		*((int *) 0xD0C4) = var7;
	}
	else
	{
		*((int *) 0xBD101004) = ((var1 & 0xFFFFFF7F) | (0 & 1));
	}
	ra = ((int *) sp)[2];
	var2 = ((int *) sp)[1];
	var3 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x860C
 */
void sceNandLock (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	var1 = *((int *) 0xD094);
	((int *) sp)[0] = s0;
	((int *) sp)[2] = ra;
	var4 = sceKernelLockMutex (var1, 1, 0);
	var5 = var4;
	if (!(var4 < 0))
	{
		var6 = *((int *) 0xD09C);
		if (var6 == 0)
		{
			*((int *) 0xD09C) = 1;
			sceSysregEmcsmBusClockEnable ();
		}
		var7 = 0;
		if (!(arg1 != 0))
		{
			var7 = 1;
		}
		sceNandSetWriteProtect (var7);
		var5 = 0;
	}
	ra = ((int *) sp)[2];
	var10 = ((int *) sp)[1];
	var11 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x868C
 */
void sceNandUnlock ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	((int *) sp)[2] = ra;
	*((int *) 0xD0D0) = 0;
	sceNandSetWriteProtect (1);
	var3 = *((int *) 0xD0A0);
	if (var3 == 0)
	{

	label8:
		*((int *) 0xD09C) = 0;
		sceSysregEmcsmBusClockDisable ();
		var12 = *((int *) 0xD094);
	}
	else
	{
		var4 = ((int *) var3)[3];
		var7 var8 = (*var4) ();
		var9 = *((int *) 0xD094);
		if (!(var7 != 0))
			goto label8;
	}
	var15 = sceKernelUnlockMutex (var12, 1);
	ra = ((int *) sp)[2];
	var16 = ((int *) sp)[1];
	var17 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x86F8
 */
void sceNandReset (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = s0;
	var1 = arg1;
	((int *) sp)[1] = ra;
	var2 = *((int *) 0xBD101038);
	*((int *) 0xBD101038) = ((var2 & 0xFFFFFFFE) | (0 & 1));
	*((int *) 0xBD101008) = 0xFF;
	var5 = sub_0953C ();
	var6 = var5;
	if (!(var5 < 0))
	{
		*((int *) 0xBD101008) = 0x70;
		var7 = *((int *) 0xBD101300);
		if (var1 != 0)
		{
			((char *) var1)[0] = var7;
		}
		*((int *) 0xBD101014) = 1;
		var6 = !((var7 & 1)) ? 0 : 0x80230001;
	}
	ra = ((int *) sp)[1];
	var8 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x8780
 */
int sceNandReadId (int arg1, int arg2)
{
	*((int *) 0xBD101008) = 0x90;
	var1 = 0;
	*((int *) 0xBD10100C) = 0;
	if (!(arg2 <= 0))
	{
		while (1) {
			var2 = *((int *) 0xBD101300);
			var1 = var1 + 1;
			if (!(arg1 == 0))
			{
				((char *) (arg1 + var1))[0] = (var2 & 0xFF);
			}
			if (!(((var1 < arg2)) != 0))
				break;
			continue;
		}
	}
	*((int *) 0xBD101014) = 1;
	return 0;
}

/**
 * Subroutine at address 0x87D8
 */
int sceNandReadAccess (int arg1, int arg2, int arg3, int arg4, int arg5)
{
	sp = sp + 0xFFFFFFD0;
	((int *) sp)[5] = s5;
	var1 = arg5;
	((int *) sp)[4] = s4;
	var2 = arg1;
	((int *) sp)[3] = s3;
	var3 = arg3;
	((int *) sp)[2] = s2;
	var4 = arg2;
	((int *) sp)[1] = s1;
	var5 = arg4;
	var6 = 0x80000104;
	((int *) sp)[8] = ra;
	((int *) sp)[7] = s7;
	((int *) sp)[6] = s6;
	((int *) sp)[0] = s0;
	if (!(((arg4 < 0x21)) == 0))
	{
		var6 = 0x80230008;
		if (!(((((arg1 & 0x1F) + var5) < 0x21)) == 0))
		{
			var6 = 0x80000103;
			if (!(((var4 | var3) & 0x03) != 0))
			{
				var9 = sceKernelCpuSuspendIntr ();
				*((int *) 0xD0AC) = var5;
				*((int *) 0xD0B4) = var4;
				*((int *) 0xD0B8) = var3;
				*((int *) 0xD0A8) = 0;
				*((int *) 0xD0B0) = var2;
				*((int *) 0xD0BC) = var1;
				var12 = sub_08200 ();
				if (var12 == 0)
				{
					var32 = *((int *) 0xBD101038);
					*((int *) 0xBD101038) = (var32 & 0xFFFFFDFC);
					var35 = sub_08200 ();
					if (var35 == 0)
					{
						*((int *) 0xD0A4) = 1;
					}
					else
					{
						var36 = *((int *) 0xBD101038);
						*((int *) 0xBD101038) = (((var36 & 0xFFFFFFFE) | (0 & 1)) | 0x0202);

					label16:
						*((int *) 0xD0A4) = 0x03;
						if ((var1 & 0x10) == 0)
						{
							var31 = *((int *) 0xBD101000);
							var14 = var31 | 0x00010000;
						}
						else
						{
							var13 = *((int *) 0xBD101000);
							var14 = (var13 & 0xFFFEFFFF) | (0 & 1);
						}
						*((int *) 0xBD101000) = var14;
						*((int *) 0xBD101020) = (var2 << 0x0A);
						var15 = *((int *) 0xBD101038);
						*((int *) 0xBD101038) = (var15 & 0xFFFFFEFC);
						*((int *) 0xBD101024) = 0x0301;
					}
				}
				else
				{
					goto label16;
				}
				sceKernelCpuResumeIntrWithSync (var9);
				var18 = *((int *) 0xD098);
				var21 = sceKernelWaitEventFlag (var18, 1, 0x21, 0, 0);
				var6 = var21;
				if (!(var21 < 0))
				{
					var22 = *((int *) 0xD0A8);
					var6 = 0x80230003;
					if (!((var22 & 1) != 0))
					{
						var6 = !((var22 & 2)) ? 0 : 0x80230009;
					}
				}
			}
		}
	}
	ra = ((int *) sp)[8];
	var23 = ((int *) sp)[7];
	var24 = ((int *) sp)[6];
	var25 = ((int *) sp)[5];
	var26 = ((int *) sp)[4];
	var27 = ((int *) sp)[3];
	var28 = ((int *) sp)[2];
	var29 = ((int *) sp)[1];
	var30 = ((int *) sp)[0];
	sp = sp + 0x30;
	return var6;
}

/**
 * Subroutine at address 0x89BC
 */
int sceNandWriteAccess (int arg1, int arg2, int arg3, int arg4, int arg5)
{
	sp = sp + 0xFFFFFFD0;
	((int *) sp)[1] = s1;
	var1 = arg4;
	((int *) sp)[5] = s5;
	var2 = 0x80000104;
	var3 = arg2;
	((int *) sp)[4] = s4;
	var4 = arg5;
	((int *) sp)[3] = s3;
	var5 = arg1;
	((int *) sp)[2] = s2;
	var6 = arg3;
	((int *) sp)[8] = ra;
	((int *) sp)[7] = s7;
	((int *) sp)[6] = s6;
	((int *) sp)[0] = s0;
	if (((arg4 < 0x21)) == 0)
	{

	label33:
		ra = ((int *) sp)[8];
	}
	else
	{
		var2 = 0x80230008;
		if (((((arg1 & 0x1F) + var1) < 0x21)) == 0)
			goto label33;
		var2 = 0x80000103;
		if ((var6 & 0x03) != 0)
			goto label33;
		if (var3 == 0)
		{
			var2 = 0x80000107;
			if ((var4 & 0x10) != 0)
			{

			label8:
				if (var6 == 0)
				{
					var2 = 0x80000107;
					if ((var4 & 0x20) != 0)
					{

					label11:
						var9 = sub_0953C ();
						var2 = var9;
						if (!(var9 < 0))
						{
							var12 = sceKernelCpuSuspendIntr ();
							*((int *) 0xD0AC) = var1;
							*((int *) 0xD0A8) = 0;
							*((int *) 0xD0B0) = var5;
							*((int *) 0xD0B4) = var3;
							*((int *) 0xD0B8) = var6;
							*((int *) 0xD0BC) = var4;
							var15 = sub_08200 ();
							var16 = var5;
							if (var15 == 0)
							{
								var34 = *((int *) 0xBD101038);
								*((int *) 0xBD101038) = (var34 & 0xFFFFFDFC);
								var37 = sub_08200 ();
								if (var37 == 0)
								{
									*((int *) 0xD0A4) = 2;
								}
								else
								{
									var38 = *((int *) 0xBD101038);
									*((int *) 0xBD101038) = (((var38 & 0xFFFFFFFE) | (0 & 1)) | 0x0202);
									var16 = var5;

								label25:
									*((int *) 0xD0A4) = 0x04;
									sub_092D4 (var4, var16, var3, var6);
								}
							}
							else
							goto label25;
							sceKernelCpuResumeIntrWithSync (var12);
							var21 = *((int *) 0xD098);
							var24 = sceKernelWaitEventFlag (var21, 1, 0x21, 0, 0);
							var2 = var24;
							if (!(var24 < 0))
							{
								var25 = *((int *) 0xD0A8);
								var2 = !(var25) ? 0 : 0x80230005;
							}
						}
						goto label33;
					}
					else
					{
						ra = ((int *) sp)[8];
					}
				}
				else
				goto label11;
			}
			else
			{
				ra = ((int *) sp)[8];
			}
		}
		else
		goto label8;
	}
	var26 = ((int *) sp)[7];
	var27 = ((int *) sp)[6];
	var28 = ((int *) sp)[5];
	var29 = ((int *) sp)[4];
	var30 = ((int *) sp)[3];
	var31 = ((int *) sp)[2];
	var32 = ((int *) sp)[1];
	var33 = ((int *) sp)[0];
	sp = sp + 0x30;
	return var2;
}

/**
 * Subroutine at address 0x8B80
 */
int sceNandEraseBlock (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	((int *) sp)[2] = ra;
	var1 = arg1;
	var4 = sub_0953C ();
	var5 = var4;
	if (!(var4 < 0))
	{
		var6 = *((int *) 0xD0C0);
		if (var6 != 0)
		{
			*((int *) 0xD0C0) = 0;
			var18 = sceKernelGetSystemTimeLow ();
			var19 = *((int *) 0xD0C4);
			if ((((var18 - var19) < 0x0A)) == 0)
			{

			label12:
				var7 = var1 << 0x0A;
			}
			else
			{
				sceKernelDelayThread (0x0A);
				var7 = var1 << 0x0A;
			}
		}
		else
		goto label12;
		*((int *) 0xBD101008) = 0x60;
		*((int *) 0xBD10100C) = var7;
		var8 = *((int *) 0xBD101038);
		*((int *) 0xBD101038) = ((var8 & 0xFFFFFFFE) | (0 & 1));
		*((int *) 0xBD101008) = 0xD0;
		var11 = sub_0953C ();
		var5 = var11;
		if (!(var11 < 0))
		{
			*((int *) 0xBD101008) = 0x70;
			var12 = *((int *) 0xBD101300);
			var5 = 0x80230007;
			*((int *) 0xBD101014) = 1;
			var13 = var12 & 0xFF;
			if (((char) var13) < 0)
			{
				var5 = !((var13 & 1)) ? 0 : 0x80230004;
			}
		}
	}
	ra = ((int *) sp)[2];
	var14 = ((int *) sp)[1];
	var15 = ((int *) sp)[0];
	sp = sp + 0x10;
	return var5;
}

/**
 * Subroutine at address 0x8C84
 */
void sceNandReadExtraOnly (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[3] = s3;
	var1 = arg3;
	((int *) sp)[1] = s1;
	var2 = 0x80000104;
	var3 = arg1;
	((int *) sp)[0] = s0;
	var4 = arg2;
	((int *) sp)[5] = ra;
	((int *) sp)[4] = s4;
	((int *) sp)[2] = s2;
	if (!(((arg3 < 0x21)) == 0))
	{
		var2 = 0x80230008;
		if (!(((((arg1 & 0x1F) + var1) < 0x21)) == 0))
		{
			var2 = 0x80000103;
			if (!(var4 == 0))
			{
				var5 = 0;
				var6 = 0;
				if (!(var1 <= 0))
				{
					while (1) {
						var9 = sub_0953C ();
						var5 = var9;
						if (var9 < 0)
							break;
						*((int *) 0xBD101008) = 0x50;
						var10 = 0x03;
						*((int *) 0xBD10100C) = (var3 << 0x0A);
						while (1) {
							var11 = *((int *) 0xBD101300);
							var10 = var10 + 0xFFFFFFFF;
							((char *) var4)[1] = (var11 >> 0x08);
							((char *) var4)[2] = (var11 >> 0x10);
							((char *) var4)[3] = (var11 >> 0x18);
							((char *) var4)[0] = var11;
							var4 = var4 + 0x04;
							if (var10 >= 0)
								continue;
							break;
						}
						var6 = var6 + 1;
						var3 = var3 + 1;
						if (((var6 < var1)) != 0)
							continue;
						break;
					}
				}
				*((int *) 0xBD101014) = 1;
				var2 = var5;
			}
		}
	}
	ra = ((int *) sp)[5];
	var12 = ((int *) sp)[4];
	var13 = ((int *) sp)[3];
	var14 = ((int *) sp)[2];
	var15 = ((int *) sp)[1];
	var16 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x8DAC
 */
void sub_08DAC ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = ra;
	((int *) sp)[0] = s0;
	sceNandLock (0);
	sceKernelUnregisterSysEventHandler (0xBEC4);
	var5 = *((int *) 0xD094);
	sceKernelDeleteMutex (var5);
	var8 = *((int *) 0xD098);
	sceKernelDeleteEventFlag (var8);
	sceKernelReleaseIntrHandler (0x14);
	ra = ((int *) sp)[1];
	var13 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x8E00
 */
void sceNandEnd ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = ra;
	((int *) sp)[0] = s0;
	sceNandLock (0);
	sceKernelUnregisterSysEventHandler (0xBEC4);
	var5 = *((int *) 0xD094);
	sceKernelDeleteMutex (var5);
	var8 = *((int *) 0xD098);
	sceKernelDeleteEventFlag (var8);
	sceKernelReleaseIntrHandler (0x14);
	ra = ((int *) sp)[1];
	var13 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x8E54
 */
void sceNandSuspend ()
{
	return;
}

/**
 * Subroutine at address 0x8E5C
 */
void sceNandResume ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = ra;
	((int *) sp)[0] = s0;
	sceSysregEmcsmBusClockEnable ();
	sceSysregEmcsmIoEnable ();
	var5 = *((int *) 0xD0CC);
	*((int *) 0xBD101038) = 0x0303;
	*((int *) 0xBD101200) = var5;
	sceNandSetWriteProtect (0);
	var8 = *((int *) 0xD0A0);
	if (var8 == 0)
	{

	label13:
		*((int *) 0xD09C) = 0;
		sceSysregEmcsmBusClockDisable ();
	}
	else
	{
		var9 = ((int *) var8)[3];
		var12 var13 = (*var9) ();
		if (!(var12 != 0))
			goto label13;
		*((int *) 0xD09C) = 1;
	}
	ra = ((int *) sp)[1];
	var16 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x8EE0
 */
void sceNandReadStatus ()
{
	*((int *) 0xBD101008) = 0x70;
	var1 = *((int *) 0xBD101300);
	*((int *) 0xBD101014) = 1;
	return;
}

/**
 * Subroutine at address 0x8F14
 */
void sceNandSetScramble (int arg1)
{
	*((int *) 0xD0D0) = arg1;
	return;
}

/**
 * Subroutine at address 0x8F24
 */
int sceNandReadPages (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = ra;
	((int *) sp)[0] = s0;
	var3 = sceNandReadAccess (arg1, arg2, arg3, arg4, 0);
	ra = ((int *) sp)[1];
	var4 = ((int *) sp)[0];
	sp = sp + 0x10;
	return (((((arg3 < 1)) & (((var3 ^ 0x80230009) < 1)))) ? 0 : var3);
}

/**
 * Subroutine at address 0x8F68
 */
int sceNandWritePages (int arg1, int arg2, int arg3, int arg4)
{
	var1 = (arg2) ? 0 : 0x10;
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var4 = sceNandWriteAccess (arg1, arg2, arg3, arg4, (!(arg3) ? (var1 | 0x20) : var1));
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return var4;
}

/**
 * Subroutine at address 0x8F90
 */
void sceNandReadPagesRawExtra (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var3 = sceNandReadAccess (arg1, arg2, arg3, arg4, 0x20);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x8FAC
 */
void sceNandWritePagesRawExtra (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var3 = sceNandWriteAccess (arg1, arg2, arg3, arg4, (!(arg2) ? 0x30 : 0x20));
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x8FD0
 */
int sceNandReadPagesRawAll (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var3 = sceNandReadAccess (arg1, arg2, arg3, arg4, 0x31);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return var3;
}

/**
 * Subroutine at address 0x8FEC
 */
void sceNandWritePagesRawAll (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var3 = sceNandWriteAccess (arg1, arg2, arg3, arg4, 0x31);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x9008
 */
void sub_09008 (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = ra;
	((int *) sp)[0] = s0;
	if (arg1 == 0x4004)
	{

	label18:
		ra = ((int *) sp)[1];
	}
	else
	{
		if (!(arg1 == 0x00010004))
			goto label18;
		sceSysregEmcsmBusClockEnable ();
		sceSysregEmcsmIoEnable ();
		var6 = *((int *) 0xD0CC);
		*((int *) 0xBD101038) = 0x0303;
		*((int *) 0xBD101200) = var6;
		sceNandSetWriteProtect (0);
		var9 = *((int *) 0xD0A0);
		if (var9 == 0)
		{

		label15:
			*((int *) 0xD09C) = 0;
			sceSysregEmcsmBusClockDisable ();
			ra = ((int *) sp)[1];
		}
		else
		{
			var10 = ((int *) var9)[3];
			var13 var14 = (*var10) ();
			if (!(var13 != 0))
				goto label15;
			*((int *) 0xD09C) = 1;
			goto label18;
		}
	}
	var1 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0x90B0
 */
int sub_090B0 (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[6] = s2;
	var1 = arg2;
	var2 = 0;
	((int *) sp)[5] = s1;
	var3 = arg1;
	((int *) sp)[4] = s0;
	var4 = arg4;
	((int *) sp)[7] = ra;
	if (arg3 == 0)
	{

	label15:
		var24 = var3 & 0x10;
	}
	else
	{
		var5 = arg3;
		var6 = 0x9FF00000;
		__asm__ ("cache			0x19, 0($t4);"
						 "cache			0x19, 64($t4);"
						 "cache			0x19, 128($t4);"
						 "cache			0x19, 192($t4);"
						 "cache			0x19, 256($t4);"
						 "cache			0x19, 320($t4);"
						 "cache			0x19, 384($t4);"
						 "cache			0x19, 448($t4);"
			: 
			: "=r"(0x9FF00000));
		if (((0xD3 >> ((arg3 >> 29) & 0x07)) & 1) == 0)
		{
		}
		else
		{
			var7 = arg3 & 0x3F;
			if (var7 == 0)
			{
				__asm__ ("cache			0x18, 0($a2);"
					: 
					: "=r"(arg3));
			}
			__asm__ ("cache			0x18, 64($a2);"
							 "cache			0x18, 128($a2);"
							 "cache			0x18, 192($a2);"
							 "cache			0x18, 256($a2);"
							 "cache			0x18, 320($a2);"
							 "cache			0x18, 384($a2);"
				: 
				: "=r"(arg3));
			if (var7 == 0)
			{
				__asm__ ("cache			0x18, 448($a2);"
					: 
					: "=r"(arg3));
			}
		}
		var8 = *((int *) 0xD0D0);
		var9 = 0x7F;
		if (var8 == 0)
		{
			while (1) {
				var46 = ((int *) var6)[0];
				var9 = var9 + 0xFFFFFFFF;
				var6 = var6 + 0x04;
				((int *) var5)[0] = var46;
				var5 = var5 + 0x04;
				if (var9 >= 0)
					continue;
				break;
			}
			var24 = var3 & 0x10;
		}
		else
		{
			var10 = ROTV (0x15, var8);
			var11 = (ROTV (0x11, var1)) ^ ((var10 << 0x03) - var10);
			var12 = (0x9FF00000 & 0xFFFFFE0F) | ((var1 ^ var10) & 0x1F);
			while (1) {
				var13 = ((int *) var12)[0];
				var14 = ((int *) var12)[1];
				var15 = ((int *) var12)[2];
				var16 = ((int *) var12)[3];
				var17 = var13 - var11;
				var18 = var11 + var17;
				((int *) var5)[0] = var17;
				var19 = var14 - var18;
				var20 = var18 ^ var19;
				((int *) var5)[1] = var19;
				var21 = var15 - var20;
				var22 = var20 - var21;
				((int *) var5)[2] = var21;
				var23 = var16 - var22;
				((int *) var5)[3] = var23;
				var5 = var5 + 0x10;
				var12 = ((var12 + 0x10) & 0xFFFFFDFF) | (0 & 1);
				var11 = BITREV (((var22 + var23) + var10));
				if (var5 != (var5 + 0x0200))
					continue;
				break;
			}
			goto label15;
		}
	}
	if (!(var24 != 0))
	{
		var25 = *((int *) 0xBD101028);
		var2 = (var25) ? 1 : 0;
	}
	var26 = *((int *) 0xBFF00800);
	((int *) sp)[0] = var26;
	var27 = *((int *) 0xBFF00900);
	((int *) sp)[1] = var27;
	var28 = *((int *) 0xBFF00904);
	((int *) sp)[2] = var28;
	var29 = *((int *) 0xBFF00908);
	((int *) sp)[3] = var29;
	if ((var3 & 0x20) == 0)
	{
		var40 = ((unsigned char *) sp)[13];
		var41 = ((unsigned char *) sp)[12];
		var42 = sp + 0x04;
		var45 = sceNandCollectEcc (var42, (((var40 << 0x08) | var41) & 0x0FFF));
		var2 = !((var45 ^ 0xFFFFFFFD)) ? (var2 | 2) : var2;
	}
	if (!(var4 == 0))
	{
		var30 = ((int *) sp)[2];
		if ((var3 & 1) == 0)
		{
			var38 = ((int *) sp)[3];
			var39 = ((int *) sp)[1];
			((int *) var4)[1] = var30;
			((int *) var4)[0] = var39;
			((int *) var4)[2] = var38;
		}
		else
		{
			var31 = ((int *) sp)[1];
			var32 = ((int *) sp)[2];
			var33 = ((int *) sp)[3];
			var34 = ((int *) sp)[0];
			((int *) var4)[1] = var31;
			((int *) var4)[0] = var34;
			((int *) var4)[3] = var33;
			((int *) var4)[2] = var32;
		}
	}
	ra = ((int *) sp)[7];
	var35 = ((int *) sp)[6];
	var36 = ((int *) sp)[5];
	var37 = ((int *) sp)[4];
	sp = sp + 0x20;
	return var2;
}

/**
 * Subroutine at address 0x92D4
 */
void sub_092D4 (int arg1, int arg2, int arg3, int arg4)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[4] = s0;
	var1 = arg1;
	var2 = arg2;
	((int *) sp)[5] = ra;
	var3 = 0x9FF00000;
	__asm__ ("cache			0x18, 0($t5);"
					 "cache			0x18, 64($t5);"
					 "cache			0x18, 128($t5);"
					 "cache			0x18, 192($t5);"
					 "cache			0x18, 256($t5);"
					 "cache			0x18, 320($t5);"
					 "cache			0x18, 384($t5);"
					 "cache			0x18, 448($t5);"
		: 
		: "=r"(0x9FF00000));
	if (arg3 == 0)
	{
		var40 = 0x7F;
		while (1) {
			var40 = var40 + 0xFFFFFFFF;
			((int *) var3)[0] = 0xFFFFFFFF;
			var3 = var3 + 0x04;
			if (var40 >= 0)
				continue;
			break;
		}
	}
	else
	{
		var4 = *((int *) 0xD0D0);
		var5 = 0;
		if (var4 == 0)
		{
			while (1) {
				var39 = ((int *) arg3)[0];
				var5 = var5 + 1;
				((int *) var3)[0] = var39;
				arg3 = arg3 + 0x04;
				var3 = var3 + 0x04;
				if (((var5 < 0x80)) != 0)
					continue;
				break;
			}
		}
		else
		{
			var6 = ROTV (0x15, var4);
			var7 = (ROTV (0x11, var2)) ^ ((var6 << 0x03) - var6);
			var8 = (0x9FF00000 & 0xFFFFFE0F) | ((var2 ^ var6) & 0x1F);
			while (1) {
				var9 = ((int *) arg3)[0];
				var10 = ((int *) arg3)[1];
				var11 = ((int *) arg3)[2];
				var12 = ((int *) arg3)[3];
				arg3 = arg3 + 0x10;
				var13 = var7 + var9;
				((int *) var8)[0] = (var9 + var7);
				var14 = var13 ^ var10;
				((int *) var8)[1] = (var10 + var13);
				var15 = var14 - var11;
				((int *) var8)[2] = (var11 + var14);
				((int *) var8)[3] = (var12 + var15);
				var8 = ((var8 + 0x10) & 0xFFFFFDFF) | (0 & 1);
				var7 = BITREV (((var15 + var12) + var6));
				if (arg3 != (arg3 + 0x0200))
					continue;
				break;
			}
		}
	}
	__asm__ ("cache			0x1B, 0($v0);"
					 "cache			0x1B, 64($v0);"
					 "cache			0x1B, 128($v0);"
					 "cache			0x1B, 192($v0);"
					 "cache			0x1B, 256($v0);"
					 "cache			0x1B, 320($v0);"
					 "cache			0x1B, 384($v0);"
					 "cache			0x1B, 448($v0);"
		: 
		: "=r"(0x9FF00000));
	if ((var1 & 0x10) == 0)
	{
		var38 = *((int *) 0xBD101000);
		var22 = var38 | 0x00020000;
	}
	else
	{
		var17 = 0xFFFFFFFF;
		if (!((var1 & 1) == 0))
		{
			var18 = ((unsigned char *) arg4)[2];
			var19 = ((unsigned char *) arg4)[1];
			var20 = ((unsigned char *) arg4)[0];
			var17 = ((var18 << 0x10) | (var19 << 0x08)) | var20;
		}
		*((int *) 0xBFF00800) = var17;
		var21 = *((int *) 0xBD101000);
		var22 = (var21 & 0xFFFDFFFF) | (0 & 1);
	}
	*((int *) 0xBD101000) = var22;
	if (arg4 == 0)
	{
		var26 = 0xFFFFFFFF;
		*((int *) 0xBFF00900) = 0xFFFFFFFF;
		*((int *) 0xBFF00904) = 0xFFFFFFFF;
		var27 = var2 << 0x0A;
	}
	else
	{
		var23 = ((var1 & 1)) ? (arg4 + 0x04) : arg4;
		if ((var1 & 0x20) == 0)
		{
			var30 = ((int *) var23)[0];
			var31 = sp;
			((int *) sp)[0] = var30;
			var32 = ((int *) var23)[1];
			((int *) sp)[1] = var32;
			var35 = sceNandCalcEcc (var31);
			var36 = ((int *) sp)[0];
			var26 = var35 | 0xFFFFF000;
			*((int *) 0xBFF00900) = var36;
			var37 = ((int *) sp)[1];
			*((int *) 0xBFF00904) = var37;
			var27 = var2 << 0x0A;
		}
		else
		{
			var24 = ((int *) var23)[0];
			*((int *) 0xBFF00900) = var24;
			var25 = ((int *) var23)[1];
			*((int *) 0xBFF00904) = var25;
			var26 = ((int *) var23)[2];
			var27 = var2 << 0x0A;
		}
	}
	*((int *) 0xBFF00908) = var26;
	*((int *) 0xBD101020) = var27;
	var28 = *((int *) 0xBD101038);
	ra = ((int *) sp)[5];
	*((int *) 0xBD101038) = (var28 & 0xFFFFFEFC);
	*((int *) 0xBD101024) = 0x0303;
	var29 = ((int *) sp)[4];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x953C
 */
int sub_0953C ()
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[4] = ra;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var3 = sub_08200 ();
	var4 = 0;
	if (var3 == 0)
	{
		var11 = sceKernelIsIntrContext ();
		if (var11 == 0)
		{
			var18 = sceKernelCpuSuspendIntr ();
			var19 = var18;
			*((int *) 0xD0A4) = 0;
			*((int *) 0xD0AC) = 0;
			var22 = sub_08200 ();
			if (var22 == 0)
			{
				var25 = *((int *) 0xBD101038);
				*((int *) 0xBD101038) = (var25 & 0xFFFFFDFC);
				var28 = sub_08200 ();
				if (var28 == 0)
				{
					sceKernelCpuResumeIntrWithSync (var19);
					var32 = *((int *) 0xD098);
					var35 = sceKernelWaitEventFlag (var32, 1, 0x21, 0, 0);
					var4 = MIN (var35, var28);
				}
				else
				{
					var29 = *((int *) 0xBD101038);
					*((int *) 0xBD101038) = (((var29 & 0xFFFFFFFE) | (0 & 1)) | 0x0202);

				label22:
					*((int *) 0xD0A4) = 0xFFFFFFFF;
					sceKernelCpuResumeIntrWithSync (var19);
					var4 = 0;
				}
			}
			else
			goto label22;
		}
		else
		{
			while (1) {
				var14 = sub_08200 ();
				var4 = 0;
				if (var14 != 0)
					break;
				var15 = 0x03E6;
				while (1) {
					if (!(var15 >= 0))
						break;
					var15 = var15 + 0xFFFFFFFF;
					continue;
				}
				continue;
			}
		}
	}
	ra = ((int *) sp)[4];
	var5 = ((int *) sp)[3];
	var6 = ((int *) sp)[2];
	var7 = ((int *) sp)[1];
	var8 = ((int *) sp)[0];
	sp = sp + 0x20;
	return var4;
}

/**
 * Subroutine at address 0x9660
 */
void sceNandDetectChip ()
{
	sp = sp + 0xFFFFFFE0;
	var1 = sp;
	((int *) sp)[5] = ra;
	((int *) sp)[4] = s0;
	var4 = sceNandReadId (var1, 2);
	var5 = var4;
	if (!(var4 < 0))
	{
		var6 = ((unsigned char *) sp)[1];
		var7 = ((unsigned char *) sp)[0];
		*((int *) 0xD704) = 0;
		*((char *) 0xD709) = var6;
		*((int *) 0xD6FC) = 0;
		var8 = 0;
		*((int *) 0xD700) = 0;
		*((char *) 0xD708) = var7;
		var9 = 0xBC08;
		while (1) {
			var10 = ((unsigned char *) var9)[0];
			if (var10 == var7)
			{
				var23 = ((unsigned char *) var9)[1];
				if (!(var23 != var6))
					break;
				var8 = var8 + 1;

			label12:
				var9 = var9 + 0x0C;
				if (((var8 < 0x14)) != 0)
					continue;
				var5 = 0x80000004;
				if (!(0 == 0))
				{
					var11 = var8 << 1;
					goto label15;
				}
			}
			else
			{
				var8 = var8 + 1;
				goto label12;
			}
			goto label22;
		}
		var11 = var8 << 1;

	label15:
		var12 = ((var11 + var8) << 2) + 0xBC08;
		var13 = ((unsigned char *) var12)[3];
		var14 = ((unsigned short *) var12)[3];
		var15 = ((int *) var12)[2];
		var16 = ((unsigned short *) var12)[2];
		*((int *) 0xD700) = var14;
		*((int *) 0xD704) = var15;
		*((char *) 0xD70A) = var13;
		*((int *) 0xD6FC) = var16;
		var19 = sceSysregGetTachyonVersion ();
		if (!(((0x004FFFFF < var19)) != 0))
		{
			*((char *) 0xD70A) = 1;
		}
		var20 = *((int *) 0xD6FC);
		if (var20 != 0x0200)
		{

		label21:
			var5 = 0x80000003;
		}
		else
		{
			var21 = *((int *) 0xD700);
			var5 = 0;
			if (!(var21 == 0x20))
				goto label21;
		}
	}

label22:
	ra = ((int *) sp)[5];
	var22 = ((int *) sp)[4];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x9784
 */
int sceNandWriteBlockWithVerify (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[5] = ra;
	((int *) sp)[4] = s4;
	((int *) sp)[3] = s3;
	var1 = arg2;
	((int *) sp)[2] = s2;
	var2 = arg3;
	((int *) sp)[1] = s1;
	var3 = 0;
	((int *) sp)[0] = s0;
	var4 = arg1;
	while (1) {
		var7 = sceNandEraseBlockWithRetry (var4);
		var3 = var3 + 1;
		var8 = var4;
		var9 = var1;
		if (!(var7 < 0))
		{
			var10 = *((int *) 0xD700);
			var13 = sceNandWritePages (var8, var9, var2, var10);
			var7 = MIN (var13, 0);
			var8 = var4;
			var9 = var1;
		}
		var14 = var7;
		if (var7 < 0)
			break;
		var17 = sceNandVerifyBlockWithRetry (var8, var9, var2);
		var14 = 0;
		if (var17 >= 0)
			break;
		var14 = var17;
		if (((var3 < 0x04)) != 0)
			continue;
		break;
	}
	ra = ((int *) sp)[5];
	var18 = ((int *) sp)[4];
	var19 = ((int *) sp)[3];
	var20 = ((int *) sp)[2];
	var21 = ((int *) sp)[1];
	var22 = ((int *) sp)[0];
	sp = sp + 0x20;
	return var14;
}

/**
 * Subroutine at address 0x9838
 */
void sceNandReadBlockWithRetry (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[5] = ra;
	((int *) sp)[4] = s4;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = 0;
	while (1) {
		var2 = *((int *) 0xD700);
		var5 = sceNandReadPages (arg1, arg2, arg3, var2);
		var1 = var1 + 1;
		var6 = 0;
		if (var5 >= 0)
			break;
		var6 = var5;
		if (((var1 < 0x04)) != 0)
			continue;
		break;
	}
	ra = ((int *) sp)[5];
	var7 = ((int *) sp)[4];
	var8 = ((int *) sp)[3];
	var9 = ((int *) sp)[2];
	var10 = ((int *) sp)[1];
	var11 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x98BC
 */
int sceNandVerifyBlockWithRetry (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFC0;
	((int *) sp)[9] = s5;
	((int *) sp)[6] = s2;
	var1 = 0;
	var2 = arg2;
	((int *) sp)[5] = s1;
	var3 = arg3;
	((int *) sp)[13] = ra;
	((int *) sp)[12] = fp;
	((int *) sp)[11] = s7;
	((int *) sp)[10] = s6;
	((int *) sp)[8] = s4;
	((int *) sp)[7] = s3;
	((int *) sp)[4] = s0;
	var4 = *((int *) 0xD700);
	((int *) sp)[0] = arg1;
	if (var4 <= 0)
	{

	label20:
		var17 = 0;

	label21:
		ra = ((int *) sp)[13];
	}
	else
	{
		((int *) sp)[1] = 0;
		while (1) {
			var5 = ((int *) sp)[0];
			var6 = ((int *) sp)[1];
			var7 = 0;
			var8 = var5 + var1;
			var9 = var8;
			while (1) {
				var12 = sceNandReadPages (var9, 0xD0D4, 0xD2D4, 1);
				if (var12 < 0)
				{
					var7 = var7 + 1;
					var17 = var12;
					if (((var7 < 0x04)) != 0)
					{

					label10:
						if (var2 == 0)
						{

						label14:
							if (var3 == 0)
							{

							label18:
								var9 = var8;
								if (var12 < 0)
									continue;
								var21 = ((int *) sp)[1];
								var22 = *((int *) 0xD700);
								var1 = var1 + 1;
								((int *) sp)[1] = (var21 + 0x0C);
								if (((var1 < var22)) != 0)
									continue;
								goto label20;
							}
							else
							{
								var20 = memcmp (0xD2D4, (var3 + var6), 0x08);
								var17 = 0x80230006;
								if (var20 != 0)
									break;
								goto label18;
							}
						}
						else
						{
							var13 = *((int *) 0xD6FC);
							var16 = memcmp (0xD0D4, (var2 + (var13 * var1)), var13);
							var17 = 0x80230006;
							if (var16 != 0)
								break;
							goto label14;
						}
					}
					else
					{
						ra = ((int *) sp)[13];
					}
				}
				else
				goto label10;
				goto label22;
			}
		}
		goto label21;
	}

label22:
	var23 = ((int *) sp)[12];
	var24 = ((int *) sp)[11];
	var25 = ((int *) sp)[10];
	var26 = ((int *) sp)[9];
	var27 = ((int *) sp)[8];
	var28 = ((int *) sp)[7];
	var29 = ((int *) sp)[6];
	var30 = ((int *) sp)[5];
	var31 = ((int *) sp)[4];
	sp = sp + 0x40;
	return var17;
}

/**
 * Subroutine at address 0x9A0C
 */
int sceNandEraseBlockWithRetry (int arg1)
{
	var1 = *((int *) 0xD700);
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[1] = s1;
	var2 = 0x80230008;
	((int *) sp)[2] = ra;
	((int *) sp)[0] = s0;
	if (var1 == 0)
	{
		__asm__ ("break			0x7;");
	}
	var3 = 0;
	if (!((arg1 % var1) != 0))
	{
		while (1) {
			var6 = sceNandEraseBlock (arg1);
			var3 = var3 + 1;
			var2 = 0;
			if (var6 >= 0)
				break;
			var2 = var6;
			if (((var3 < 0x04)) != 0)
				continue;
			break;
		}
	}
	ra = ((int *) sp)[2];
	var7 = ((int *) sp)[1];
	var8 = ((int *) sp)[0];
	sp = sp + 0x10;
	return var2;
}

/**
 * Subroutine at address 0x9A80
 */
void sceNandIsBadBlock (int arg1)
{
	var1 = *((int *) 0xD700);
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[5] = s1;
	var2 = 0x80230008;
	((int *) sp)[6] = ra;
	((int *) sp)[4] = s0;
	if (var1 == 0)
	{
		__asm__ ("break			0x7;");
	}
	var3 = 0;
	if (!((arg1 % var1) != 0))
	{
		while (1) {
			var4 = sp;
			var3 = var3 + 1;
			var7 = sceNandReadPagesRawAll (arg1, 0, var4, 1);
			if (var7 >= 0)
			{
				var10 = ((unsigned char *) sp)[5];
				var2 = (0 < (var10 ^ 0xFF));
			}
			else
			{
				var2 = var7;
				if (((var3 < 0x04)) != 0)
					continue;
				break;
			}
		}
	}
	ra = ((int *) sp)[6];
	var8 = ((int *) sp)[5];
	var9 = ((int *) sp)[4];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x9B0C
 */
void sceNandDoMarkAsBadBlock (int arg1)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[5] = s5;
	((int *) sp)[1] = s1;
	var1 = arg1;
	((int *) sp)[7] = ra;
	((int *) sp)[6] = s6;
	((int *) sp)[4] = s4;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	var2 = *((int *) 0xD700);
	if (var2 == 0)
	{
		__asm__ ("break			0x7;");
	}
	var3 = 0x80230008;
	if (!((arg1 % var2) != 0))
	{
		memset (0xD2E0, 0, 0x0200);
		memset (0xD4E0, 0xFF, 0x0C);
		var8 = *((int *) 0xD700);
		*((char *) 0xD4E1) = 0xFFFFFFF0;
		var9 = 0;
		var10 = 0;
		if (!(var8 <= 0))
		{
			var11 = var1 + 0;
			while (1) {
				var12 = var11;
				while (1) {
					var15 = sceNandWritePages (var12, 0xD2E0, 0xD4E0, 1);
					if (var15 >= 0)
						break;
					var9 = var9 + 1;
					var12 = var11;
					if (((var9 < 0x04)) != 0)
						continue;
					var16 = *((int *) 0xD700);
					goto label18;
				}
				var16 = *((int *) 0xD700);

			label18:
				var10 = var10 + 1;
				var11 = var1 + var10;
				if (((var10 < var16)) != 0)
					continue;
				break;
			}
		}
		var3 = 0;
	}
	ra = ((int *) sp)[7];
	var17 = ((int *) sp)[6];
	var18 = ((int *) sp)[5];
	var19 = ((int *) sp)[4];
	var20 = ((int *) sp)[3];
	var21 = ((int *) sp)[2];
	var22 = ((int *) sp)[1];
	var23 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x9C18
 */
void sceNandDumpWearBBMSize ()
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[6] = s6;
	((int *) sp)[1] = s1;
	var1 = 0;
	((int *) sp)[0] = s0;
	((int *) sp)[7] = ra;
	((int *) sp)[5] = s5;
	((int *) sp)[4] = s4;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	var2 = *((int *) 0xD704);
	var3 = 0;
	if (var2 <= 0)
	{

	label21:
		var9 = var1;
	}
	else
	{
		while (1) {
			var4 = *((int *) 0xD700);
			var5 = 0;
			var8 = sceNandDetectChipMakersBBM ((var3 * var4));
			var9 = var8;
			if (var8 < 0)
				break;
			if (var8 == 1)
			{
				var1 = var1 + 1;

			label19:
				var14 = *((int *) 0xD704);
			}
			else
			{
				var10 = *((int *) 0xD700);
				var13 = sceNandTestBlock ((var3 * var10));
				if (var13 < 0)
				{
					var22 = *((int *) 0xD700);
					var5 = 1;
					sceNandDoMarkAsBadBlock ((var3 * var22));
				}
				if (var5 == 0)
				{
					var14 = *((int *) 0xD704);
				}
				else
				{
					var1 = var1 + 1;
					goto label19;
				}
			}
			var3 = var3 + 1;
			if (((var3 < var14)) != 0)
				continue;
			goto label21;
		}
	}
	ra = ((int *) sp)[7];
	var15 = ((int *) sp)[6];
	var16 = ((int *) sp)[5];
	var17 = ((int *) sp)[4];
	var18 = ((int *) sp)[3];
	var19 = ((int *) sp)[2];
	var20 = ((int *) sp)[1];
	var21 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x9D04
 */
void sceNandCountChipMakersBBM ()
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = 0;
	((int *) sp)[4] = ra;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	var2 = *((int *) 0xD704);
	var3 = 0;
	if (var2 <= 0)
	{

	label9:
		var8 = var1;
	}
	else
	{
		var4 = *((int *) 0xD700);
		while (1) {
			var3 = var3 + 1;
			var7 = sceNandDetectChipMakersBBM ((var3 * var4));
			var1 = var1 + (((var7 ^ 1) < 1));
			var8 = var7;
			if (var7 < 0)
				break;
			var9 = *((int *) 0xD704);
			if (!(((var3 < var9)) != 0))
				goto label9;
			var4 = *((int *) 0xD700);
			continue;
		}
	}
	ra = ((int *) sp)[4];
	var10 = ((int *) sp)[3];
	var11 = ((int *) sp)[2];
	var12 = ((int *) sp)[1];
	var13 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x9D98
 */
int sceNandDetectChipMakersBBM (int arg1)
{
	sp = sp + 0xFFFFFFD0;
	((int *) sp)[6] = s6;
	((int *) sp)[5] = s5;
	var1 = 0;
	((int *) sp)[4] = s4;
	((int *) sp)[9] = ra;
	((int *) sp)[8] = fp;
	((int *) sp)[7] = s7;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var2 = *((unsigned char *) 0xD70A);
	var3 = 0;
	if (var2 == 0)
	{

	label10:
		var8 = 0;
	}
	else
	{
		while (1) {
			var4 = var4 + 1;
			var7 = sceNandReadPagesRawAll ((arg1 + var3), 0xD4EC, 0xD6EC, 1);
			if (var7 >= 0)
			{
				var18 = *((unsigned char *) 0xD6F1);
				var1 = ((var18 ^ 0xFF)) ? 1 : var1;
				var8 = 1;
				if (var1 != 0)
					break;
				var19 = *((unsigned char *) 0xD70A);
				var3 = var3 + 1;
				if (((var3 < var19)) != 0)
					continue;
				goto label10;
			}
			else
			{
				var8 = var7;
				if (((var4 < 0x04)) != 0)
					continue;
			}
		}
	}
	ra = ((int *) sp)[9];
	var9 = ((int *) sp)[8];
	var10 = ((int *) sp)[7];
	var11 = ((int *) sp)[6];
	var12 = ((int *) sp)[5];
	var13 = ((int *) sp)[4];
	var14 = ((int *) sp)[3];
	var15 = ((int *) sp)[2];
	var16 = ((int *) sp)[1];
	var17 = ((int *) sp)[0];
	sp = sp + 0x30;
	return var8;
}

/**
 * Subroutine at address 0x9E90
 */
void sceNandEraseAllBlock ()
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = 0;
	((int *) sp)[4] = ra;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	var2 = *((int *) 0xD704);
	var3 = 0;
	if (!(var2 <= 0))
	{
		var4 = *((int *) 0xD700);
		while (1) {
			var3 = var3 + 1;
			var7 = sceNandEraseBlockWithRetry ((var3 * var4));
			var1 = var1 + ((var7 < 0));
			if (var7 == 0x80230007)
			{
				var1 = 0x80230007;
			}
			else
			{
				var8 = *((int *) 0xD704);
				if (!(((var3 < var8)) != 0))
					break;
				var4 = *((int *) 0xD700);
				continue;
			}
		}
	}
	ra = ((int *) sp)[4];
	var9 = ((int *) sp)[3];
	var10 = ((int *) sp)[2];
	var11 = ((int *) sp)[1];
	var12 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

/**
 * Subroutine at address 0x9F28
 */
int sceNandTestBlock (int arg1)
{
	sp = sp + 0xFFFFBDE0;
	((int *) sp)[4226] = s2;
	((int *) sp)[4225] = s1;
	var1 = arg1;
	((int *) sp)[4229] = ra;
	((int *) sp)[4228] = s4;
	((int *) sp)[4227] = s3;
	((int *) sp)[4224] = s0;
	var2 = *((int *) 0xD700);
	if (var2 == 0)
	{
		__asm__ ("break			0x7;");
	}
	var3 = 0x80230008;
	if (!((arg1 % var2) != 0))
	{
		var6 = sceNandEraseBlockWithRetry (arg1);
		var3 = var6;
		if (!(var6 < 0))
		{
			var7 = *((int *) 0xD700);
			var8 = sp + 0x4000;
			var9 = sp;
			var12 = sceNandReadPagesRawAll (var1, var9, var8, var7);
			var3 = var12;
			if (!(var12 < 0))
			{
				var13 = *((int *) 0xD700);
				var14 = 0;
				if (var13 <= 0)
				{

				label21:
					var25 = 0;
					var26 = sp;
					while (1) {
						if (var25 == 0)
						{
							memset (var26, 0, 0x4000);

						label30:
							memset (var8, 0xFF, 0x0180);
							var27 = var1;
						}
						else
						{
							if (var25 == 1)
							{
								memset (var26, 0xFF, 0x4000);
								goto label30;
							}
							else
							{
								var27 = var1;
							}
						}
						var28 = sp;
						var31 = sceNandWriteBlockWithVerify (var27, var28, var8);
						var25 = var25 + 1;
						var32 = var31;
						if (var32 < 0)
							break;
						var33 = sp;
						if (((var25 < 2)) != 0)
							continue;
						break;
					}
					var36 = sceNandEraseBlockWithRetry (var1);
					var3 = var32;
				}
				else
				{
					var15 = sp;
					var16 = sp;
					while (1) {
						var17 = 0;
						var18 = var16;
						var19 = var18 + 0;
						while (1) {
							var20 = ((int *) var19)[0];
							var17 = var17 + 0x04;
							var3 = 0x80230004;
							if (var20 != 0xFFFFFFFF)
								break;
							var19 = var18 + var17;
							if (((var17 < 0x0200)) != 0)
								continue;
							var21 = 0x04;
							var22 = var15;
							var23 = var22 + 0x04;
							while (1) {
								var24 = ((unsigned char *) var23)[16384];
								var21 = var21 + 1;
								var3 = 0x80230004;
								if (var24 != 0xFF)
									break;
								if (((var21 < 0x10)) != 0)
								{
									var23 = var22 + var21;
									continue;
								}
								else
								{
									var14 = var14 + 1;
									var16 = var16 + 0x0200;
									var15 = var15 + 0x10;
									if (((var14 < var13)) != 0)
										continue;
									goto label21;
								}
							}
						}
					}
				}
			}
		}
	}
	ra = ((int *) sp)[4229];
	var37 = ((int *) sp)[4228];
	var38 = ((int *) sp)[4227];
	var39 = ((int *) sp)[4226];
	var40 = ((int *) sp)[4225];
	var41 = ((int *) sp)[4224];
	sp = sp + 0x4220;
	return var3;
}

/**
 * Subroutine at address 0xA0D8
 */
void sceNandGetPageSize ()
{
	var1 = *((int *) 0xD6FC);
	return;
}

/**
 * Subroutine at address 0xA0E4
 */
void sceNandGetPagesPerBlock ()
{
	var1 = *((int *) 0xD700);
	return;
}

/**
 * Subroutine at address 0xA0F0
 */
void sceNandGetTotalBlocks ()
{
	var1 = *((int *) 0xD704);
	return;
}

/**
 * Subroutine at address 0xA0FC
 */
void sceNandWriteBlock (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	((int *) sp)[3] = ra;
	var3 = sceNandEraseBlockWithRetry (arg1);
	if (!(var3 < 0))
	{
		var4 = *((int *) 0xD700);
		var7 = sceNandWritePages (arg1, arg2, arg3, var4);
	}
	ra = ((int *) sp)[3];
	var8 = ((int *) sp)[2];
	var9 = ((int *) sp)[1];
	var10 = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0xA15C
 */
int sceNandCalcEcc (int arg1)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[3] = s3;
	((int *) sp)[2] = s2;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = ((unsigned char *) arg1)[0];
	var2 = ((unsigned char *) arg1)[1];
	var3 = ((unsigned char *) arg1)[2];
	var4 = ((unsigned char *) arg1)[3];
	var5 = ((unsigned char *) arg1)[4];
	var6 = var1 ^ var2;
	var7 = ((unsigned char *) arg1)[5];
	var8 = ((unsigned char *) arg1)[6];
	var9 = var4 ^ (var3 ^ var6);
	var10 = ((unsigned char *) arg1)[7];
	var11 = (var10 ^ (var8 ^ (var7 ^ (var5 ^ var9)))) & 0xFF;
	var12 = var9 & 0xFF;
	var13 = (var10 ^ (var8 ^ (var5 ^ var7))) & 0xFF;
	var14 = (var10 ^ (var8 ^ (var3 ^ var4))) & 0xFF;
	var15 = (var7 ^ (var5 ^ var6)) & 0xFF;
	var16 = (var10 ^ (var7 ^ (var2 ^ var4))) & 0xFF;
	var17 = (var8 ^ (var5 ^ (var1 ^ var3))) & 0xFF;
	var18 = ((int *) sp)[3];
	var19 = ((int *) sp)[2];
	var20 = ((int *) sp)[1];
	var21 = ((int *) sp)[0];
	sp = sp + 0x10;
	return (((((((((0x6996 >> (var11 >> 0x04)) & 1) << 0x08) | (((0x6996 >> (var11 & 0x0F)) & 1) << 2)) | ((((0x6996 >> (var11 & 0x0C)) ^ (0x6996 >> ((var11 & 0xCC) >> 0x04))) & 1) << 0x07)) | ((((0x6996 >> (var11 & 0x03)) ^ (0x6996 >> ((var11 >> 4) & 0x03))) & 1) << 1)) | ((((0x6996 >> (var11 & 0x0A)) ^ (0x6996 >> ((var11 & 0xAA) >> 0x04))) & 1) << 6)) | (((0x6996 >> (var11 & 0x05)) ^ (0x6996 >> ((var11 & 0x55) >> 0x04))) & 1)) | (((((((((0x6996 >> (var13 & 0x0F)) ^ (0x6996 >> (var13 >> 0x04))) & 1) << 0x0B) | ((((0x6996 >> (var12 & 0x0F)) ^ (0x6996 >> (var12 >> 0x04))) & 1) << 0x05)) | ((((0x6996 >> (var14 & 0x0F)) ^ (0x6996 >> (var14 >> 0x04))) & 1) << 0x0A)) | ((((0x6996 >> (var15 & 0x0F)) ^ (0x6996 >> (var15 >> 0x04))) & 1) << 0x04)) | ((((0x6996 >> (var16 & 0x0F)) ^ (0x6996 >> (var16 >> 0x04))) & 1) << 0x09)) | ((((0x6996 >> (var17 & 0x0F)) ^ (0x6996 >> (var17 >> 0x04))) & 1) << 0x03)));
}

/**
 * Subroutine at address 0xA388
 */
void sceNandVerifyEcc (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var3 = sub_0A3C0 (arg1, arg2, 0);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0xA3A4
 */
int sceNandCollectEcc (int arg1, int arg2)
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	var3 = sub_0A3C0 (arg1, arg2, 1);
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return var3;
}

/**
 * Subroutine at address 0xA3C0
 */
int sub_0A3C0 (int arg1, int arg2, int arg3)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[4] = s4;
	((int *) sp)[2] = s2;
	((int *) sp)[5] = s5;
	((int *) sp)[3] = s3;
	((int *) sp)[1] = s1;
	((int *) sp)[0] = s0;
	var1 = ((unsigned char *) arg1)[0];
	var2 = ((unsigned char *) arg1)[1];
	var3 = ((unsigned char *) arg1)[2];
	var4 = ((unsigned char *) arg1)[3];
	var5 = ((unsigned char *) arg1)[4];
	var6 = var1 ^ var2;
	var7 = ((unsigned char *) arg1)[5];
	var8 = ((unsigned char *) arg1)[6];
	var9 = var4 ^ (var3 ^ var6);
	var10 = ((unsigned char *) arg1)[7];
	var11 = (var10 ^ (var8 ^ (var7 ^ (var5 ^ var9)))) & 0xFF;
	var12 = var9 & 0xFF;
	var13 = (var10 ^ (var8 ^ (var5 ^ var7))) & 0xFF;
	var14 = (var10 ^ (var8 ^ (var3 ^ var4))) & 0xFF;
	var15 = (var7 ^ (var5 ^ var6)) & 0xFF;
	var16 = (var10 ^ (var7 ^ (var2 ^ var4))) & 0xFF;
	var17 = (var8 ^ (var5 ^ (var1 ^ var3))) & 0xFF;
	var18 = (((((((((0x6996 >> (var11 >> 0x04)) & 1) << 0x08) | (((0x6996 >> (var11 & 0x0F)) & 1) << 2)) | ((((0x6996 >> (var11 & 0x0C)) ^ (0x6996 >> ((var11 & 0xCC) >> 0x04))) & 1) << 0x07)) | ((((0x6996 >> (var11 & 0x03)) ^ (0x6996 >> ((var11 >> 4) & 0x03))) & 1) << 1)) | ((((0x6996 >> (var11 & 0x0A)) ^ (0x6996 >> ((var11 & 0xAA) >> 0x04))) & 1) << 6)) | (((0x6996 >> (var11 & 0x05)) ^ (0x6996 >> ((var11 & 0x55) >> 0x04))) & 1)) | (((((((((0x6996 >> (var13 & 0x0F)) ^ (0x6996 >> (var13 >> 0x04))) & 1) << 0x0B) | ((((0x6996 >> (var12 & 0x0F)) ^ (0x6996 >> (var12 >> 0x04))) & 1) << 0x05)) | ((((0x6996 >> (var14 & 0x0F)) ^ (0x6996 >> (var14 >> 0x04))) & 1) << 0x0A)) | ((((0x6996 >> (var15 & 0x0F)) ^ (0x6996 >> (var15 >> 0x04))) & 1) << 0x04)) | ((((0x6996 >> (var16 & 0x0F)) ^ (0x6996 >> (var16 >> 0x04))) & 1) << 0x09)) | ((((0x6996 >> (var17 & 0x0F)) ^ (0x6996 >> (var17 >> 0x04))) & 1) << 0x03))) ^ arg2;
	var19 = 0;
	if (!(var18 == 0))
	{
		var20 = ((var18 >> 6) ^ var18) & 0x3F;
		var21 = 0;
		if (var20 == 0x3F)
		{
			var19 = 0xFFFFFFFF;
			if (!(arg3 == 0))
			{
				((char *) arg1)[7] = (var10 ^ 0x80);
			}
		}
		else
		{
			while (1) {
				var19 = var19 + 1;
				var21 = var21 + ((var20 >> var19) & 1);
				if (((var19 < 6)) != 0)
					continue;
				break;
			}
			var19 = ((var21 ^ 1)) ? 0xFFFFFFFD : 0xFFFFFFFE;
		}
	}
	var22 = ((int *) sp)[5];
	var23 = ((int *) sp)[4];
	var24 = ((int *) sp)[3];
	var25 = ((int *) sp)[2];
	var26 = ((int *) sp)[1];
	var27 = ((int *) sp)[0];
	sp = sp + 0x20;
	return var19;
}
void sub_0A6B0 ()
{
	sp = sp + 0xFFFFFFF0;
	((int *) sp)[0] = ra;
	DmacManForKernel_32757C57 (0);
	sceDdrEnd ();
	ra = ((int *) sp)[0];
	sp = sp + 0x10;
	return;
}

/**
 * Subroutine at address 0xA6D8
 */
void sceDdr_driver_B639BE04 (int arg1)
{
	sp = sp + 0xFFFFFFE0;
	((int *) sp)[1] = s1;
	var1 = arg1;
	((int *) sp)[3] = s3;
	var2 = 0x800001FE;
	((int *) sp)[5] = ra;
	((int *) sp)[4] = s4;
	((int *) sp)[2] = s2;
	((int *) sp)[0] = s0;
	if (!((((arg1 | 0x08) < 0x0E)) == 0))
	{
		var5 = sceKernelCpuSuspendIntr ();
		var6 = *((int *) 0xBF04);
		if (!(var6 < 0))
		{
			var9 = sceDdr_driver_C6B7CCDE ();
			((int *) ((var6 << 2) + 0xBF08))[0] = var9;
		}
		*((int *) 0xBF04) = var1;
		var10 = ((int *) ((var1 << 2) + 0xBF08))[0];
		sceKernelDcacheWritebackAll ();
		var13 = *((int *) 0xBC000044);
		var14 = 0x0F;
		*((int *) 0xBC000044) = ((var13 & 0xC000FFFF) | (0 & 0x3FFF));
		var15 = *((int *) 0xBC100068);
		var16 = *((int *) 0xBC10004C);
		if ((var16 & 0x04) != 0)
		{
			var14 = 0x05;
		}
		sceDdrFlush (var14);
		var21 var22 = (*0xBFC00C00) (var1, 0x03, var10, 0x08, 0x0A, 0xBD00);
		*((int *) 0xBC000044) = var13;
		sceSysreg_driver_2456AE40 ();
		sceKernelCpuResumeIntrWithSync (var5);
		var2 = 0;
	}
	ra = ((int *) sp)[5];
	var27 = ((int *) sp)[4];
	var28 = ((int *) sp)[3];
	var29 = ((int *) sp)[2];
	var30 = ((int *) sp)[1];
	var31 = ((int *) sp)[0];
	sp = sp + 0x20;
	return;
}

